MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / ObtainSession

Method ObtainSession

libi2pd/Datagram.cpp:504–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 2

SetVersionMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected