mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-08 22:57:52 +00:00
skip resent recently sessions during resend
This commit is contained in:
parent
f5b823a712
commit
124698854f
@ -987,7 +987,8 @@ namespace transport
|
||||
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
for (auto it: m_Sessions)
|
||||
{
|
||||
resentPacketsNum += it.second->Resend (ts);
|
||||
if (ts >= it.second->GetLastResendTime () + SSU2_RESEND_CHECK_TIMEOUT)
|
||||
resentPacketsNum += it.second->Resend (ts);
|
||||
if (resentPacketsNum > SSU2_MAX_RESEND_PACKETS) break;
|
||||
}
|
||||
for (auto it: m_PendingOutgoingSessions)
|
||||
|
@ -90,7 +90,8 @@ namespace transport
|
||||
m_WindowSize (SSU2_MIN_WINDOW_SIZE),
|
||||
m_RTO (SSU2_INITIAL_RTO), m_RelayTag (0),m_ConnectTimer (server.GetService ()),
|
||||
m_TerminationReason (eSSU2TerminationReasonNormalClose),
|
||||
m_MaxPayloadSize (SSU2_MIN_PACKET_SIZE - IPV6_HEADER_SIZE - UDP_HEADER_SIZE - 32) // min size
|
||||
m_MaxPayloadSize (SSU2_MIN_PACKET_SIZE - IPV6_HEADER_SIZE - UDP_HEADER_SIZE - 32), // min size
|
||||
m_LastResendTime (0)
|
||||
{
|
||||
m_NoiseState.reset (new i2p::crypto::NoiseSymmetricState);
|
||||
if (in_RemoteRouter && m_Address)
|
||||
@ -565,6 +566,7 @@ namespace transport
|
||||
it++;
|
||||
if (!resentPackets.empty ())
|
||||
{
|
||||
m_LastResendTime = ts;
|
||||
#if (__cplusplus >= 201703L) // C++ 17 or higher
|
||||
m_SentPackets.merge (resentPackets);
|
||||
#else
|
||||
|
@ -256,7 +256,8 @@ namespace transport
|
||||
void SendLocalRouterInfo (bool update) override;
|
||||
void SendI2NPMessages (const std::vector<std::shared_ptr<I2NPMessage> >& msgs) override;
|
||||
uint32_t GetRelayTag () const override { return m_RelayTag; };
|
||||
size_t Resend (uint64_t ts); // return number or resent packets
|
||||
size_t Resend (uint64_t ts); // return number of resent packets
|
||||
uint64_t GetLastResendTime () const { return m_LastResendTime; };
|
||||
bool IsEstablished () const override { return m_State == eSSU2SessionStateEstablished; };
|
||||
uint64_t GetConnID () const { return m_SourceConnID; };
|
||||
SSU2SessionState GetState () const { return m_State; };
|
||||
@ -369,6 +370,7 @@ namespace transport
|
||||
size_t m_MaxPayloadSize;
|
||||
std::unique_ptr<i2p::data::IdentHash> m_PathChallenge;
|
||||
std::unordered_map<uint32_t, uint32_t> m_ReceivedI2NPMsgIDs; // msgID -> timestamp in seconds
|
||||
uint64_t m_LastResendTime; // in milliseconds
|
||||
};
|
||||
|
||||
inline uint64_t CreateHeaderMask (const uint8_t * kh, const uint8_t * nonce)
|
||||
|
Loading…
Reference in New Issue
Block a user