store session with Alice with PeerTest

This commit is contained in:
orignal 2015-03-26 16:10:52 -04:00
parent c62659cdbc
commit d226a4a0b7
3 changed files with 17 additions and 8 deletions

14
SSU.cpp
View file

@ -256,7 +256,6 @@ namespace transport
std::shared_ptr<SSUSession> SSUServer::FindSession (const boost::asio::ip::udp::endpoint& e) const
{
std::unique_lock<std::mutex> l(m_SessionsMutex);
auto it = m_Sessions.find (e);
if (it != m_Sessions.end ())
return it->second;
@ -473,9 +472,9 @@ namespace transport
}
}
void SSUServer::NewPeerTest (uint32_t nonce, PeerTestParticipant role)
void SSUServer::NewPeerTest (uint32_t nonce, PeerTestParticipant role, std::shared_ptr<SSUSession> session)
{
m_PeerTests[nonce] = { i2p::util::GetMillisecondsSinceEpoch (), role };
m_PeerTests[nonce] = { i2p::util::GetMillisecondsSinceEpoch (), role, session };
}
PeerTestParticipant SSUServer::GetPeerTestParticipant (uint32_t nonce)
@ -487,6 +486,15 @@ namespace transport
return ePeerTestParticipantUnknown;
}
std::shared_ptr<SSUSession> SSUServer::GetPeerTestSession (uint32_t nonce)
{
auto it = m_PeerTests.find (nonce);
if (it != m_PeerTests.end ())
return it->second.session;
else
return nullptr;
}
void SSUServer::UpdatePeerTest (uint32_t nonce, PeerTestParticipant role)
{
auto it = m_PeerTests.find (nonce);