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

Function TryConnect

library/cpp/coroutine/engine/helper.cpp:8–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6namespace NCoro {
7
8 bool TryConnect(const TString& host, ui16 port, TDuration timeout) {
9 bool connected = false;
10
11 auto f = [&connected, &host, port, timeout](TCont* c) {
12 TSocketHolder socket;
13 TNetworkAddress address(host, port);
14 connected = (0 == NCoro::ConnectT(c, socket, address, timeout));
15 };
16
17 TContExecutor e(128 * 1024);
18 e.Create(f, "try_connect");
19 e.Execute();
20 return connected;
21 }
22
23 bool WaitUntilConnectable(const TString& host, ui16 port, TDuration timeout) {
24 const TInstant deadline = timeout.ToDeadLine();

Callers 1

WaitUntilConnectableFunction · 0.85

Calls 3

ConnectTFunction · 0.85
CreateMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected