MCPcopy Create free account
hub / github.com/MonaSolutions/MonaServer / removeByAddress

Method removeByAddress

MonaCore/sources/Sessions.cpp:66–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void Sessions::removeByAddress(const SocketAddress& address,Session& session) {
67 if (session._sessionsOptions&BYADDRESS) {
68 auto& map(dynamic_cast<UDProtocol*>(&session.protocol()) ? _sessionsByAddress[0] : _sessionsByAddress[1]);
69 if (map.erase(address)==0) {
70 ERROR("Session ",session.name()," unfound in address sessions collection with key ",address.toString());
71 for (auto it = map.begin(); it != map.end();++it) {
72 if (it->second == &session) {
73 INFO("The correct key was ",it->first.toString());
74 map.erase(it);
75 break;
76 }
77 }
78 }
79 }
80}
81
82void Sessions::addByPeer(Session& session) {
83 if (session._sessionsOptions&BYADDRESS) {

Callers

nothing calls this directly

Calls 3

eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected