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

Method Run

library/cpp/neh/tcp2.cpp:640–679  ·  view source on GitHub ↗

called from client thread

Source from the content-addressed store, hash-verified

638
639 //called from client thread
640 bool Run(TRequestRef& req) {
641 if (Y_UNLIKELY(AtomicGet(State_) == Closed)) {
642 return false;
643 }
644
645 req->Ref();
646 try {
647 Reqs_.Enqueue(req.Get());
648 } catch (...) {
649 req->UnRef();
650 throw;
651 }
652
653 NeedCheckReqsQueue_.store(true);
654 req->SetConnection(this);
655 TAtomicBase state = AtomicGet(State_);
656 if (Y_LIKELY(state == Connected)) {
657 ProcessOutputReqsQueue();
658 return true;
659 }
660
661 if (state == Init) {
662 if (AtomicCas(&State_, Connecting, Init)) {
663 try {
664 TEndpoint addr(new NAddr::TAddrInfo(&*req->Addr()->Addr.Begin()));
665 AS_.AsyncConnect(addr, std::bind(&TConnection::OnConnect, TConnectionRef(this), _1, _2), TTcp2Options::ConnectTimeout);
666 } catch (...) {
667 AS_.GetIOService().Post(std::bind(&TConnection::OnErrorCallback, TConnectionRef(this), CurrentExceptionMessage()));
668 }
669 return true;
670 }
671 }
672 state = AtomicGet(State_);
673 if (state == Connected) {
674 ProcessOutputReqsQueue();
675 } else if (state == Closed) {
676 SafeOnError();
677 }
678 return true;
679 }
680
681 //called from client thread
682 void Cancel(TRequestId id) {

Callers

nothing calls this directly

Calls 13

CurrentExceptionMessageFunction · 0.85
SetConnectionMethod · 0.80
AtomicGetFunction · 0.50
AtomicCasFunction · 0.50
RefMethod · 0.45
EnqueueMethod · 0.45
GetMethod · 0.45
UnRefMethod · 0.45
storeMethod · 0.45
BeginMethod · 0.45
AddrMethod · 0.45
AsyncConnectMethod · 0.45

Tested by

no test coverage detected