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

Method CacheConnection

library/cpp/netliba/v12/udp_http.cpp:714–731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712 return connection;
713 }
714 void CacheConnection(const TIntrusivePtr<IConnection>& connection) const {
715 const TUdpAddress& addr = connection->GetAddress();
716 const TConnectionSettings& connectionSettings = connection->GetSettings();
717
718 TConnectionsCache::iterator c = Find(ConnectionsCache, addr, connectionSettings);
719 if (c != ConnectionsCache.end()) {
720 c->second = connection; // they are equal or we overwrite old connection
721 Y_ASSERT(Find(OldConnectionsCache, addr, connectionSettings) == OldConnectionsCache.end());
722 return;
723 }
724
725 c = Find(OldConnectionsCache, addr, connectionSettings);
726 if (c != OldConnectionsCache.end()) {
727 OldConnectionsCache.erase(c);
728 }
729
730 ConnectionsCache.insert(std::make_pair(addr, connection));
731 }
732 void Step() {
733 {
734 TGuard<TSpinLock> lock(CS);

Callers

nothing calls this directly

Calls 6

GetAddressMethod · 0.80
GetSettingsMethod · 0.80
FindFunction · 0.50
endMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected