| 502 | } |
| 503 | |
| 504 | std::shared_ptr<DatagramSession> DatagramDestination::ObtainSession(const i2p::data::IdentHash & identity) |
| 505 | { |
| 506 | std::shared_ptr<DatagramSession> session = nullptr; |
| 507 | std::lock_guard<std::mutex> lock(m_SessionsMutex); |
| 508 | auto itr = m_Sessions.find(identity); |
| 509 | if (itr == m_Sessions.end()) |
| 510 | { |
| 511 | // not found, create new session |
| 512 | session = std::make_shared<DatagramSession>(m_Owner, identity); |
| 513 | session->SetVersion (m_Version); |
| 514 | session->Start (); |
| 515 | m_Sessions.emplace (identity, session); |
| 516 | } |
| 517 | else |
| 518 | session = itr->second; |
| 519 | return session; |
| 520 | } |
| 521 | |
| 522 | std::shared_ptr<DatagramSession> DatagramDestination::FindSession(const i2p::data::IdentHash& ident) const |
| 523 | { |
nothing calls this directly
no test coverage detected