mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
full implementation of peer test
This commit is contained in:
parent
34e31f3d78
commit
51aea367c3
4 changed files with 90 additions and 40 deletions
22
SSU.cpp
22
SSU.cpp
|
@ -463,12 +463,28 @@ namespace transport
|
|||
}
|
||||
}
|
||||
|
||||
void SSUServer::NewPeerTest (uint32_t nonce)
|
||||
void SSUServer::NewPeerTest (uint32_t nonce, PeerTestParticipant role)
|
||||
{
|
||||
m_PeerTests[nonce] = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
m_PeerTests[nonce] = { i2p::util::GetMillisecondsSinceEpoch (), role };
|
||||
}
|
||||
|
||||
void SSUServer::PeerTestComplete (uint32_t nonce)
|
||||
PeerTestParticipant SSUServer::GetPeerTestParticipant (uint32_t nonce)
|
||||
{
|
||||
auto it = m_PeerTests.find (nonce);
|
||||
if (it != m_PeerTests.end ())
|
||||
return it->second.role;
|
||||
else
|
||||
return ePeerTestParticipantUnknown;
|
||||
}
|
||||
|
||||
void SSUServer::UpdatePeerTest (uint32_t nonce, PeerTestParticipant role)
|
||||
{
|
||||
auto it = m_PeerTests.find (nonce);
|
||||
if (it != m_PeerTests.end ())
|
||||
it->second.role = role;
|
||||
}
|
||||
|
||||
void SSUServer::RemovePeerTest (uint32_t nonce)
|
||||
{
|
||||
m_PeerTests.erase (nonce);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue