mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-19 21:25:30 +00:00
send queue after batch of packets
This commit is contained in:
parent
6990f177ba
commit
3e0f5d231d
@ -108,7 +108,7 @@ namespace transport
|
|||||||
SendQueue ();
|
SendQueue ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSU2Session::SendQueue ()
|
bool SSU2Session::SendQueue ()
|
||||||
{
|
{
|
||||||
if (!m_SendQueue.empty () && m_SentPackets.size () <= m_WindowSize)
|
if (!m_SendQueue.empty () && m_SentPackets.size () <= m_WindowSize)
|
||||||
{
|
{
|
||||||
@ -149,7 +149,9 @@ namespace transport
|
|||||||
packet->nextResendTime = nextResend;
|
packet->nextResendTime = nextResend;
|
||||||
m_SentPackets.emplace (packetNum, packet);
|
m_SentPackets.emplace (packetNum, packet);
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSU2Session::SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg)
|
void SSU2Session::SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg)
|
||||||
@ -747,10 +749,7 @@ namespace transport
|
|||||||
m_LastActivityTimestamp = i2p::util::GetSecondsSinceEpoch ();
|
m_LastActivityTimestamp = i2p::util::GetSecondsSinceEpoch ();
|
||||||
m_NumReceivedBytes += len;
|
m_NumReceivedBytes += len;
|
||||||
if (UpdateReceivePacketNum (packetNum))
|
if (UpdateReceivePacketNum (packetNum))
|
||||||
{
|
|
||||||
HandlePayload (payload, payloadSize);
|
HandlePayload (payload, payloadSize);
|
||||||
SendQueue (); // if we have something to send
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSU2Session::HandlePayload (const uint8_t * buf, size_t len)
|
void SSU2Session::HandlePayload (const uint8_t * buf, size_t len)
|
||||||
@ -1245,9 +1244,10 @@ namespace transport
|
|||||||
|
|
||||||
void SSU2Session::FlushData ()
|
void SSU2Session::FlushData ()
|
||||||
{
|
{
|
||||||
|
bool sent = SendQueue (); // if we have something to send
|
||||||
if (m_IsDataReceived)
|
if (m_IsDataReceived)
|
||||||
{
|
{
|
||||||
SendQuickAck ();
|
if (!sent) SendQuickAck ();
|
||||||
m_Handler.Flush ();
|
m_Handler.Flush ();
|
||||||
m_IsDataReceived = false;
|
m_IsDataReceived = false;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ namespace transport
|
|||||||
|
|
||||||
void Established ();
|
void Established ();
|
||||||
void PostI2NPMessages (std::vector<std::shared_ptr<I2NPMessage> > msgs);
|
void PostI2NPMessages (std::vector<std::shared_ptr<I2NPMessage> > msgs);
|
||||||
void SendQueue ();
|
bool SendQueue ();
|
||||||
void SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg);
|
void SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg);
|
||||||
|
|
||||||
void ProcessSessionRequest (Header& header, uint8_t * buf, size_t len);
|
void ProcessSessionRequest (Header& header, uint8_t * buf, size_t len);
|
||||||
|
Loading…
Reference in New Issue
Block a user