mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
cleanup streaming destination's pools
This commit is contained in:
parent
d5aca85a35
commit
d4c1a1c0bb
@ -1526,7 +1526,8 @@ namespace stream
|
|||||||
|
|
||||||
StreamingDestination::StreamingDestination (std::shared_ptr<i2p::client::ClientDestination> owner, uint16_t localPort, bool gzip):
|
StreamingDestination::StreamingDestination (std::shared_ptr<i2p::client::ClientDestination> owner, uint16_t localPort, bool gzip):
|
||||||
m_Owner (owner), m_LocalPort (localPort), m_Gzip (gzip),
|
m_Owner (owner), m_LocalPort (localPort), m_Gzip (gzip),
|
||||||
m_PendingIncomingTimer (m_Owner->GetService ())
|
m_PendingIncomingTimer (m_Owner->GetService ()),
|
||||||
|
m_LastCleanupTime (i2p::util::GetSecondsSinceEpoch ())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1715,10 +1716,12 @@ namespace stream
|
|||||||
m_IncomingStreams.erase (stream->GetSendStreamID ());
|
m_IncomingStreams.erase (stream->GetSendStreamID ());
|
||||||
if (m_LastStream == stream) m_LastStream = nullptr;
|
if (m_LastStream == stream) m_LastStream = nullptr;
|
||||||
}
|
}
|
||||||
if (m_Streams.empty ())
|
auto ts = i2p::util::GetSecondsSinceEpoch ();
|
||||||
|
if (m_Streams.empty () || ts > m_LastCleanupTime + STREAMING_DESTINATION_POOLS_CLEANUP_INTERVAL)
|
||||||
{
|
{
|
||||||
m_PacketsPool.CleanUp ();
|
m_PacketsPool.CleanUp ();
|
||||||
m_I2NPMsgsPool.CleanUp ();
|
m_I2NPMsgsPool.CleanUp ();
|
||||||
|
m_LastCleanupTime = ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ namespace stream
|
|||||||
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL = 7500; // in milliseconds
|
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL = 7500; // in milliseconds
|
||||||
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL_VARIANCE = 3200; // in milliseconds
|
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL_VARIANCE = 3200; // in milliseconds
|
||||||
const bool LOSS_BASED_CONTROL_ENABLED = 1; // 0/1
|
const bool LOSS_BASED_CONTROL_ENABLED = 1; // 0/1
|
||||||
|
const uint64_t STREAMING_DESTINATION_POOLS_CLEANUP_INTERVAL = 646; // in seconds
|
||||||
|
|
||||||
struct Packet
|
struct Packet
|
||||||
{
|
{
|
||||||
@ -350,7 +351,8 @@ namespace stream
|
|||||||
|
|
||||||
i2p::util::MemoryPool<Packet> m_PacketsPool;
|
i2p::util::MemoryPool<Packet> m_PacketsPool;
|
||||||
i2p::util::MemoryPool<I2NPMessageBuffer<I2NP_MAX_SHORT_MESSAGE_SIZE> > m_I2NPMsgsPool;
|
i2p::util::MemoryPool<I2NPMessageBuffer<I2NP_MAX_SHORT_MESSAGE_SIZE> > m_I2NPMsgsPool;
|
||||||
|
uint64_t m_LastCleanupTime; // in seconds
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
i2p::data::GzipInflator m_Inflator;
|
i2p::data::GzipInflator m_Inflator;
|
||||||
|
Loading…
Reference in New Issue
Block a user