mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 02:44:15 +00:00
don't look for tunnel again if tunnelID is the same as for previous message
This commit is contained in:
parent
89dead79c4
commit
ec980edf56
15
Tunnel.cpp
15
Tunnel.cpp
@ -347,10 +347,16 @@ namespace tunnel
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
I2NPMessage * msg = m_Queue.GetNextWithTimeout (1000); // 1 sec
|
I2NPMessage * msg = m_Queue.GetNextWithTimeout (1000); // 1 sec
|
||||||
|
uint32_t prevTunnelID = 0;
|
||||||
|
TunnelBase * prevTunnel = nullptr;
|
||||||
while (msg)
|
while (msg)
|
||||||
{
|
{
|
||||||
uint32_t tunnelID = bufbe32toh (msg->GetPayload ());
|
uint32_t tunnelID = bufbe32toh (msg->GetPayload ());
|
||||||
TunnelBase * tunnel = GetInboundTunnel (tunnelID);
|
TunnelBase * tunnel = nullptr;
|
||||||
|
if (tunnelID == prevTunnelID)
|
||||||
|
tunnel = prevTunnel;
|
||||||
|
if (!tunnel)
|
||||||
|
tunnel = GetInboundTunnel (tunnelID);
|
||||||
if (!tunnel)
|
if (!tunnel)
|
||||||
tunnel = GetTransitTunnel (tunnelID);
|
tunnel = GetTransitTunnel (tunnelID);
|
||||||
if (tunnel)
|
if (tunnel)
|
||||||
@ -362,6 +368,11 @@ namespace tunnel
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg = m_Queue.Get ();
|
msg = m_Queue.Get ();
|
||||||
|
if (msg)
|
||||||
|
{
|
||||||
|
prevTunnelID = tunnelID;
|
||||||
|
prevTunnel = tunnel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user