mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-23 17:34:21 +00:00
don't send own RouterInfo twice
This commit is contained in:
parent
5896cebeaa
commit
3dbab68f17
@ -93,9 +93,7 @@ namespace transport
|
|||||||
|
|
||||||
m_DHKeysPair = nullptr;
|
m_DHKeysPair = nullptr;
|
||||||
|
|
||||||
SendTimeSyncMessage ();
|
SendTimeSyncMessage ();
|
||||||
m_SendQueue.push_back (CreateDatabaseStoreMsg ()); // we tell immediately who we are
|
|
||||||
|
|
||||||
transports.PeerConnected (shared_from_this ());
|
transports.PeerConnected (shared_from_this ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,7 +855,6 @@ namespace transport
|
|||||||
m_DHKeysPair = nullptr;
|
m_DHKeysPair = nullptr;
|
||||||
m_SignedData = nullptr;
|
m_SignedData = nullptr;
|
||||||
m_Data.Start ();
|
m_Data.Start ();
|
||||||
m_Data.Send (CreateDatabaseStoreMsg ());
|
|
||||||
transports.PeerConnected (shared_from_this ());
|
transports.PeerConnected (shared_from_this ());
|
||||||
if (m_IsPeerTest)
|
if (m_IsPeerTest)
|
||||||
SendPeerTest ();
|
SendPeerTest ();
|
||||||
|
@ -505,12 +505,24 @@ namespace transport
|
|||||||
auto it = m_Peers.find (ident);
|
auto it = m_Peers.find (ident);
|
||||||
if (it != m_Peers.end ())
|
if (it != m_Peers.end ())
|
||||||
{
|
{
|
||||||
|
bool sendDatabaseStore = true;
|
||||||
|
if (it->second.delayedMessages.size () > 0)
|
||||||
|
{
|
||||||
|
// check if first message is our DatabaseStore (publishing)
|
||||||
|
auto firstMsg = it->second.delayedMessages[0];
|
||||||
|
if (firstMsg && firstMsg->GetTypeID () == eI2NPDatabaseStore &&
|
||||||
|
i2p::data::IdentHash(firstMsg->GetPayload () + DATABASE_STORE_KEY_OFFSET) == i2p::context.GetIdentHash ())
|
||||||
|
sendDatabaseStore = false; // we have it in the list already
|
||||||
|
}
|
||||||
|
if (sendDatabaseStore)
|
||||||
|
session->SendI2NPMessages ({ CreateDatabaseStoreMsg () });
|
||||||
it->second.sessions.push_back (session);
|
it->second.sessions.push_back (session);
|
||||||
session->SendI2NPMessages (it->second.delayedMessages);
|
session->SendI2NPMessages (it->second.delayedMessages);
|
||||||
it->second.delayedMessages.clear ();
|
it->second.delayedMessages.clear ();
|
||||||
}
|
}
|
||||||
else // incoming connection
|
else // incoming connection
|
||||||
{
|
{
|
||||||
|
session->SendI2NPMessages ({ CreateDatabaseStoreMsg () }); // send DatabaseStore
|
||||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||||
m_Peers.insert (std::make_pair (ident, Peer{ 0, nullptr, { session }, i2p::util::GetSecondsSinceEpoch (), {} }));
|
m_Peers.insert (std::make_pair (ident, Peer{ 0, nullptr, { session }, i2p::util::GetSecondsSinceEpoch (), {} }));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user