| 1797 | |
| 1798 | private: |
| 1799 | void SendData(TAtomicBase requestId, TTcpSocket::TSendedData sd) { |
| 1800 | TContIOVector& vec = *sd->GetIOvec(); |
| 1801 | |
| 1802 | if (requestId != AtomicGet(PrimaryResponse_)) { |
| 1803 | // already has another request for response first, so push this to queue |
| 1804 | // + enqueue event for safe checking queue (at local/transport thread) |
| 1805 | TResponseDataRef rdr = new TResponseData(requestId, sd); |
| 1806 | ResponsesDataQueue_.Enqueue(rdr); |
| 1807 | AS_->GetIOService().Post(std::bind(&TConn::ProcessResponsesData, SelfRef())); |
| 1808 | return; |
| 1809 | } |
| 1810 | if (THttp2Options::ServerUseDirectWrite) { |
| 1811 | vec.Proceed(AS_->WriteSome(vec)); |
| 1812 | } |
| 1813 | if (!vec.Complete()) { |
| 1814 | DBGOUT("AsyncWrite()"); |
| 1815 | AS_->AsyncWrite(sd, std::bind(&TConn::OnSend, SelfRef(), _1, _2, _3), THttp2Options::ServerOutputDeadline); |
| 1816 | } else { |
| 1817 | // run ProcessPipeline at safe thread |
| 1818 | AS_->GetIOService().Post(std::bind(&TConn::ProcessPipeline, SelfRef())); |
| 1819 | } |
| 1820 | } |
| 1821 | |
| 1822 | void OnSend(const TErrorCode& ec, size_t amount, IHandlingContext&) { |
| 1823 | Y_UNUSED(amount); |