MCPcopy Create free account
hub / github.com/catboost/catboost / FlushOutputBuffers

Method FlushOutputBuffers

library/cpp/neh/tcp2.cpp:844–870  ·  view source on GitHub ↗

called non thread-safe (from outside thread)

Source from the content-addressed store, hash-verified

842
843 //called non thread-safe (from outside thread)
844 bool FlushOutputBuffers(bool asioThread, TRequestId reqId) {
845 if (asioThread || TTcp2Options::ClientUseDirectWrite) {
846 TContIOVector& vec = *OutputBuffers_.GetIOvec();
847 TErrorCode err;
848 vec.Proceed(AS_.WriteSome(vec, err));
849
850 if (Y_UNLIKELY(err)) {
851 if (asioThread) {
852 OnErrorCode(err);
853 } else {
854 AS_.GetIOService().Post(std::bind(&TConnection::OnErrorCode, TConnectionRef(this), err));
855 }
856 return false;
857 }
858
859 if (vec.Complete()) {
860 LastSendedReqId_.store(reqId, std::memory_order_release);
861 DBGOUT("Client::FlushOutputBuffers(" << reqId << ")");
862 OutputBuffers_.Clear();
863 return true;
864 }
865 }
866
867 DBGOUT("Client::AsyncWrite(" << reqId << ")");
868 AS_.AsyncWrite(OutputBuffers_.GetIOvec(), std::bind(&TConnection::OnSend, TConnectionRef(this), reqId, _1, _2, _3), TTcp2Options::ServerOutputDeadline);
869 return false;
870 }
871
872 //must be called only from asio thread
873 void OnSend(TRequestId reqId, const TErrorCode& ec, size_t amount, IHandlingContext&) {

Callers

nothing calls this directly

Calls 8

CompleteMethod · 0.80
GetIOvecMethod · 0.45
ProceedMethod · 0.45
WriteSomeMethod · 0.45
PostMethod · 0.45
storeMethod · 0.45
ClearMethod · 0.45
AsyncWriteMethod · 0.45

Tested by

no test coverage detected