mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-03-30 12:55:44 +00:00
update peer perams from RouterInfo block
This commit is contained in:
@@ -1291,6 +1291,7 @@ namespace transport
|
||||
if (remoteIdentity && remoteIdentity->GetIdentHash () == newRi->GetIdentHash ())
|
||||
// peer's RouterInfo update
|
||||
SetRemoteIdentity (newRi->GetIdentity ());
|
||||
i2p::transport::transports.UpdatePeerParams (newRi);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1772,6 +1772,7 @@ namespace transport
|
||||
m_RelayTag = 0; // not longer introducer
|
||||
}
|
||||
}
|
||||
i2p::transport::transports.UpdatePeerParams (newRi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1021,6 +1021,20 @@ namespace transport
|
||||
#endif
|
||||
}
|
||||
|
||||
void Transports::UpdatePeerParams (std::shared_ptr<const i2p::data::RouterInfo> r)
|
||||
{
|
||||
if (!r) return;
|
||||
std::shared_ptr<Peer> peer;
|
||||
{
|
||||
std::lock_guard<std::mutex> l(m_PeersMutex);
|
||||
auto it = m_Peers.find (r->GetIdentHash ());
|
||||
if (it != m_Peers.end ())
|
||||
peer = it->second;
|
||||
}
|
||||
if (peer)
|
||||
peer->UpdateParams (r);
|
||||
}
|
||||
|
||||
void Transports::HandlePeerCleanupTimer (const boost::system::error_code& ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
|
||||
@@ -159,6 +159,7 @@ namespace transport
|
||||
void PeerConnected (std::shared_ptr<TransportSession> session);
|
||||
void PeerDisconnected (std::shared_ptr<TransportSession> session);
|
||||
bool IsConnected (const i2p::data::IdentHash& ident) const;
|
||||
void UpdatePeerParams (std::shared_ptr<const i2p::data::RouterInfo> r);
|
||||
|
||||
void UpdateSentBytes (uint64_t numBytes) { m_TotalSentBytes += numBytes; };
|
||||
void UpdateReceivedBytes (uint64_t numBytes) { m_TotalReceivedBytes += numBytes; };
|
||||
|
||||
Reference in New Issue
Block a user