| 64 | } |
| 65 | |
| 66 | void 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 | |
| 82 | void Sessions::addByPeer(Session& session) { |
| 83 | if (session._sessionsOptions&BYADDRESS) { |