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

Method AllocateMore

library/cpp/coroutine/engine/sockpool.cpp:30–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30TPooledSocket TSocketPool::AllocateMore(TConnectData* conn) {
31 TCont* cont = conn->Cont;
32
33 while (true) {
34 TSocketHolder s(NCoro::Socket(Addr_->Addr()->sa_family, SOCK_STREAM, 0));
35
36 if (s == INVALID_SOCKET) {
37 ythrow TSystemError(errno) << TStringBuf("can not create socket");
38 }
39
40 SetCommonSockOpts(s, Addr_->Addr());
41 SetZeroLinger(s);
42
43 const int ret = NCoro::ConnectD(cont, s, Addr_->Addr(), Addr_->Len(), conn->DeadLine);
44
45 if (ret == EINTR) {
46 continue;
47 } else if (ret) {
48 ythrow TSystemError(ret) << TStringBuf("can not connect(") << cont->Name() << ')';
49 }
50
51 THolder<TPooledSocket::TImpl> res(new TPooledSocket::TImpl(s, this));
52 s.Release();
53
54 if (res->IsOpen()) {
55 return res.Release();
56 }
57 }
58}

Callers

nothing calls this directly

Calls 8

SocketFunction · 0.85
SetCommonSockOptsFunction · 0.85
SetZeroLingerFunction · 0.85
ConnectDFunction · 0.85
AddrMethod · 0.45
LenMethod · 0.45
ReleaseMethod · 0.45
IsOpenMethod · 0.45

Tested by

no test coverage detected