| 726 | } |
| 727 | |
| 728 | void SendRequest(const THttpRequestBuffersPtr& bfs, TErrorCode& ec) { //throw std::bad_alloc |
| 729 | if (!THttp2Options::UseAsyncSendRequest) { |
| 730 | size_t amount = AS_.WriteSome(*bfs->GetIOvec(), ec); |
| 731 | |
| 732 | if (ec && ec.Value() != EAGAIN && ec.Value() != EWOULDBLOCK && ec.Value() != EINPROGRESS) { |
| 733 | return; |
| 734 | } |
| 735 | ec.Assign(0); |
| 736 | |
| 737 | bfs->GetIOvec()->Proceed(amount); |
| 738 | |
| 739 | if (bfs->GetIOvec()->Complete()) { |
| 740 | RequestWritten_ = true; |
| 741 | StartRead(); |
| 742 | } else { |
| 743 | SendRequestAsync(bfs); |
| 744 | } |
| 745 | } else { |
| 746 | SendRequestAsync(bfs); |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | void SendRequestAsync(const THttpRequestBuffersPtr& bfs) { |
| 751 | NAsio::TTcpSocket::TSendedData sd(bfs.Release()); |