mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-16 00:12:43 +00:00
resend RouterInfo after some interval
This commit is contained in:
parent
c164601acf
commit
7e4c33d27e
@ -343,6 +343,8 @@ namespace transport
|
|||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "NTCP2: Missing NTCP2 parameters");
|
LogPrint (eLogWarning, "NTCP2: Missing NTCP2 parameters");
|
||||||
}
|
}
|
||||||
|
m_NextRouterInfoResendTime = i2p::util::GetSecondsSinceEpoch () + NTCP2_ROUTERINFO_RESEND_INTERVAL +
|
||||||
|
rand ()%NTCP2_ROUTERINFO_RESEND_INTERVAL_THRESHOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTCP2Session::~NTCP2Session ()
|
NTCP2Session::~NTCP2Session ()
|
||||||
@ -1012,7 +1014,14 @@ namespace transport
|
|||||||
m_NumSentBytes += bytes_transferred;
|
m_NumSentBytes += bytes_transferred;
|
||||||
i2p::transport::transports.UpdateSentBytes (bytes_transferred);
|
i2p::transport::transports.UpdateSentBytes (bytes_transferred);
|
||||||
LogPrint (eLogDebug, "NTCP2: Next frame sent ", bytes_transferred);
|
LogPrint (eLogDebug, "NTCP2: Next frame sent ", bytes_transferred);
|
||||||
SendQueue ();
|
if (m_LastActivityTimestamp > m_NextRouterInfoResendTime)
|
||||||
|
{
|
||||||
|
m_NextRouterInfoResendTime += NTCP2_ROUTERINFO_RESEND_INTERVAL +
|
||||||
|
rand ()%NTCP2_ROUTERINFO_RESEND_INTERVAL_THRESHOLD;
|
||||||
|
SendRouterInfo ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SendQueue ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ namespace transport
|
|||||||
const int NTCP2_ESTABLISH_TIMEOUT = 10; // 10 seconds
|
const int NTCP2_ESTABLISH_TIMEOUT = 10; // 10 seconds
|
||||||
const int NTCP2_TERMINATION_TIMEOUT = 120; // 2 minutes
|
const int NTCP2_TERMINATION_TIMEOUT = 120; // 2 minutes
|
||||||
const int NTCP2_TERMINATION_CHECK_TIMEOUT = 30; // 30 seconds
|
const int NTCP2_TERMINATION_CHECK_TIMEOUT = 30; // 30 seconds
|
||||||
|
const int NTCP2_ROUTERINFO_RESEND_INTERVAL = 25*60; // 25 minuntes in seconds
|
||||||
|
const int NTCP2_ROUTERINFO_RESEND_INTERVAL_THRESHOLD = 25*60; // 25 minuntes
|
||||||
|
|
||||||
const int NTCP2_CLOCK_SKEW = 60; // in seconds
|
const int NTCP2_CLOCK_SKEW = 60; // in seconds
|
||||||
const int NTCP2_MAX_OUTGOING_QUEUE_SIZE = 500; // how many messages we can queue up
|
const int NTCP2_MAX_OUTGOING_QUEUE_SIZE = 500; // how many messages we can queue up
|
||||||
@ -212,6 +214,7 @@ namespace transport
|
|||||||
|
|
||||||
bool m_IsSending;
|
bool m_IsSending;
|
||||||
std::list<std::shared_ptr<I2NPMessage> > m_SendQueue;
|
std::list<std::shared_ptr<I2NPMessage> > m_SendQueue;
|
||||||
|
uint64_t m_NextRouterInfoResendTime; // seconds since epoch
|
||||||
};
|
};
|
||||||
|
|
||||||
class NTCP2Server: private i2p::util::RunnableServiceWithWork
|
class NTCP2Server: private i2p::util::RunnableServiceWithWork
|
||||||
|
Loading…
Reference in New Issue
Block a user