| 509 | } |
| 510 | |
| 511 | void SSU2Server::RemoveSession (uint64_t connID) |
| 512 | { |
| 513 | auto it = m_Sessions.find (connID); |
| 514 | if (it != m_Sessions.end ()) |
| 515 | { |
| 516 | if (it->second->GetState () != eSSU2SessionStatePeerTest) |
| 517 | { |
| 518 | auto ident = it->second->GetRemoteIdentity (); |
| 519 | if (ident) |
| 520 | { |
| 521 | std::lock_guard<std::mutex> l(m_SessionsByRouterHashMutex); |
| 522 | auto it1 = m_SessionsByRouterHash.find (ident->GetIdentHash ()); |
| 523 | if (it1 != m_SessionsByRouterHash.end () && it->second == it1->second.lock ()) |
| 524 | m_SessionsByRouterHash.erase (it1); |
| 525 | } |
| 526 | } |
| 527 | if (m_LastSession == it->second) |
| 528 | m_LastSession = nullptr; |
| 529 | m_Sessions.erase (it); |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | void SSU2Server::RequestRemoveSession (uint64_t connID) |
| 534 | { |
no test coverage detected