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

Method GetConnection

library/cpp/netliba/v12/udp_http.cpp:691–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689 return cache.end();
690 }
691 TIntrusivePtr<IConnection> GetConnection(const TUdpAddress& addr, const TConnectionSettings& connectionSettings) const {
692 // actually may occur after bad dns resolving
693 // Y_ASSERT(addr != TUdpAddress());
694
695 TConnectionsCache::iterator c = Find(ConnectionsCache, addr, connectionSettings);
696 if (c != ConnectionsCache.end()) {
697 Y_ASSERT(Find(OldConnectionsCache, addr, connectionSettings) == OldConnectionsCache.end());
698 return c->second;
699 }
700
701 TIntrusivePtr<IConnection> connection;
702
703 c = Find(OldConnectionsCache, addr, connectionSettings);
704 if (c != OldConnectionsCache.end()) {
705 connection = c->second;
706 OldConnectionsCache.erase(c);
707 } else {
708 connection = Host->Connect(addr, connectionSettings);
709 }
710 ConnectionsCache.insert(std::make_pair(addr, connection));
711
712 return connection;
713 }
714 void CacheConnection(const TIntrusivePtr<IConnection>& connection) const {
715 const TUdpAddress& addr = connection->GetAddress();
716 const TConnectionSettings& connectionSettings = connection->GetSettings();

Callers

nothing calls this directly

Calls 5

FindFunction · 0.50
endMethod · 0.45
eraseMethod · 0.45
ConnectMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected