| 28 | } |
| 29 | |
| 30 | TPooledSocket 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 | } |
nothing calls this directly
no test coverage detected