mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
limit outgoing queue size
This commit is contained in:
parent
4ac4f44ba7
commit
c664be52d7
@ -713,8 +713,16 @@ namespace transport
|
|||||||
if (m_IsTerminated) return;
|
if (m_IsTerminated) return;
|
||||||
if (m_IsSending)
|
if (m_IsSending)
|
||||||
{
|
{
|
||||||
for (auto it: msgs)
|
if (m_SendQueue.size () < NTCP_MAX_OUTGOING_QUEUE_SIZE)
|
||||||
m_SendQueue.push_back (it);
|
{
|
||||||
|
for (auto it: msgs)
|
||||||
|
m_SendQueue.push_back (it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogWarning, "NTCP: outgoing messages queue size exceeds ", NTCP_MAX_OUTGOING_QUEUE_SIZE);
|
||||||
|
Terminate ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Send (msgs);
|
Send (msgs);
|
||||||
|
@ -40,6 +40,7 @@ namespace transport
|
|||||||
const size_t NTCP_DEFAULT_PHASE3_SIZE = 2/*size*/ + i2p::data::DEFAULT_IDENTITY_SIZE/*387*/ + 4/*ts*/ + 15/*padding*/ + 40/*signature*/; // 448
|
const size_t NTCP_DEFAULT_PHASE3_SIZE = 2/*size*/ + i2p::data::DEFAULT_IDENTITY_SIZE/*387*/ + 4/*ts*/ + 15/*padding*/ + 40/*signature*/; // 448
|
||||||
const int NTCP_BAN_EXPIRATION_TIMEOUT = 70; // in second
|
const int NTCP_BAN_EXPIRATION_TIMEOUT = 70; // in second
|
||||||
const int NTCP_CLOCK_SKEW = 60; // in seconds
|
const int NTCP_CLOCK_SKEW = 60; // in seconds
|
||||||
|
const int NTCP_MAX_OUTGOING_QUEUE_SIZE = 200; // how many messages we can queue up
|
||||||
|
|
||||||
class NTCPServer;
|
class NTCPServer;
|
||||||
class NTCPSession: public TransportSession, public std::enable_shared_from_this<NTCPSession>
|
class NTCPSession: public TransportSession, public std::enable_shared_from_this<NTCPSession>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user