can be called only from asio
| 773 | |
| 774 | //can be called only from asio |
| 775 | void OnReadSome(const TErrorCode& err, size_t bytes, IHandlingContext& ctx) { |
| 776 | if (Y_UNLIKELY(err)) { |
| 777 | OnError(err); |
| 778 | return; |
| 779 | } |
| 780 | if (!BeginReadResponse_) { |
| 781 | //used in MessageSendedCompletely() |
| 782 | BeginReadResponse_ = true; |
| 783 | THttpRequestRef r(GetRequest()); |
| 784 | if (!!r) { |
| 785 | r->OnBeginRead(); |
| 786 | } |
| 787 | } |
| 788 | DBGOUT("receive:" << TStringBuf(Buff_.Get(), bytes)); |
| 789 | try { |
| 790 | if (!Prs_) { |
| 791 | throw yexception() << TStringBuf("receive some data while not in request"); |
| 792 | } |
| 793 | |
| 794 | #if defined(_linux_) |
| 795 | if (THttp2Options::QuickAck) { |
| 796 | SetSockOpt(AS_.Native(), SOL_TCP, TCP_QUICKACK, (int)1); |
| 797 | } |
| 798 | #endif |
| 799 | |
| 800 | DBGOUT("parse:"); |
| 801 | while (!Prs_->Parse(Buff_.Get(), bytes)) { |
| 802 | if (BuffSize_ == bytes) { |
| 803 | TErrorCode ec; |
| 804 | bytes = AS_.ReadSome(Buff_.Get(), BuffSize_, ec); |
| 805 | |
| 806 | if (!ec) { |
| 807 | continue; |
| 808 | } |
| 809 | |
| 810 | if (ec.Value() != EAGAIN && ec.Value() != EWOULDBLOCK) { |
| 811 | OnError(ec); |
| 812 | |
| 813 | return; |
| 814 | } |
| 815 | } |
| 816 | //continue async. read from socket |
| 817 | ctx.ContinueUseHandler(THttp2Options::InputDeadline); |
| 818 | |
| 819 | return; |
| 820 | } |
| 821 | |
| 822 | //succesfully reach end of http response |
| 823 | THttpRequestRef r(ReleaseRequest()); |
| 824 | if (!r) { |
| 825 | //lost race to req. canceling |
| 826 | DBGOUT("connection failed"); |
| 827 | return; |
| 828 | } |
| 829 | |
| 830 | DBGOUT("response:"); |
| 831 | bool keepALive = Prs_->IsKeepAlive(); |
| 832 |
nothing calls this directly
no test coverage detected