1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 04:04:16 +00:00

dont re-request LS

This commit is contained in:
Jeff 2016-12-26 18:47:47 -05:00
parent 59dd479a6d
commit f3d4077142
2 changed files with 8 additions and 3 deletions

View File

@ -168,7 +168,8 @@ namespace datagram
const i2p::data::IdentHash & remoteIdent) :
m_LocalDestination(localDestination),
m_RemoteIdent(remoteIdent),
m_SendQueueTimer(localDestination->GetService())
m_SendQueueTimer(localDestination->GetService()),
m_RequestingLS(false)
{
m_LastUse = i2p::util::GetMillisecondsSinceEpoch ();
ScheduleFlushSendQueue();
@ -221,7 +222,10 @@ namespace datagram
}
if(!m_RemoteLeaseSet) {
// no remote lease set
m_LocalDestination->RequestDestination(m_RemoteIdent, std::bind(&DatagramSession::HandleLeaseSetUpdated, this, std::placeholders::_1));
if(!m_RequestingLS) {
m_RequestingLS = true;
m_LocalDestination->RequestDestination(m_RemoteIdent, std::bind(&DatagramSession::HandleLeaseSetUpdated, this, std::placeholders::_1));
}
return nullptr;
}
m_RoutingSession = m_LocalDestination->GetRoutingSession(m_RemoteLeaseSet, true);
@ -290,6 +294,7 @@ namespace datagram
void DatagramSession::HandleLeaseSetUpdated(std::shared_ptr<i2p::data::LeaseSet> ls)
{
m_RequestingLS = false;
if(!ls) return;
// only update lease set if found and newer than previous lease set
uint64_t oldExpire = 0;

View File

@ -88,7 +88,7 @@ namespace datagram
boost::asio::deadline_timer m_SendQueueTimer;
std::vector<std::shared_ptr<I2NPMessage> > m_SendQueue;
uint64_t m_LastUse;
bool m_RequestingLS;
};
const size_t MAX_DATAGRAM_SIZE = 32768;