mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
TransitTunnelParticipant
This commit is contained in:
57
Tunnel.cpp
57
Tunnel.cpp
@@ -347,32 +347,41 @@ namespace tunnel
|
||||
try
|
||||
{
|
||||
I2NPMessage * msg = m_Queue.GetNextWithTimeout (1000); // 1 sec
|
||||
uint32_t prevTunnelID = 0;
|
||||
TunnelBase * prevTunnel = nullptr;
|
||||
while (msg)
|
||||
{
|
||||
uint32_t tunnelID = bufbe32toh (msg->GetPayload ());
|
||||
TunnelBase * tunnel = nullptr;
|
||||
if (tunnelID == prevTunnelID)
|
||||
tunnel = prevTunnel;
|
||||
if (!tunnel)
|
||||
tunnel = GetInboundTunnel (tunnelID);
|
||||
if (!tunnel)
|
||||
tunnel = GetTransitTunnel (tunnelID);
|
||||
if (tunnel)
|
||||
tunnel->HandleTunnelDataMsg (msg);
|
||||
else
|
||||
{
|
||||
LogPrint ("Tunnel ", tunnelID, " not found");
|
||||
DeleteI2NPMessage (msg);
|
||||
}
|
||||
|
||||
msg = m_Queue.Get ();
|
||||
if (msg)
|
||||
if (msg)
|
||||
{
|
||||
uint32_t prevTunnelID = 0;
|
||||
TunnelBase * prevTunnel = nullptr;
|
||||
do
|
||||
{
|
||||
prevTunnelID = tunnelID;
|
||||
prevTunnel = tunnel;
|
||||
uint32_t tunnelID = bufbe32toh (msg->GetPayload ());
|
||||
TunnelBase * tunnel = nullptr;
|
||||
if (tunnelID == prevTunnelID)
|
||||
tunnel = prevTunnel;
|
||||
else if (prevTunnel)
|
||||
prevTunnel->FlushTunnelDataMsgs ();
|
||||
|
||||
if (!tunnel)
|
||||
tunnel = GetInboundTunnel (tunnelID);
|
||||
if (!tunnel)
|
||||
tunnel = GetTransitTunnel (tunnelID);
|
||||
if (tunnel)
|
||||
tunnel->HandleTunnelDataMsg (msg);
|
||||
else
|
||||
{
|
||||
LogPrint ("Tunnel ", tunnelID, " not found");
|
||||
DeleteI2NPMessage (msg);
|
||||
}
|
||||
|
||||
msg = m_Queue.Get ();
|
||||
if (msg)
|
||||
{
|
||||
prevTunnelID = tunnelID;
|
||||
prevTunnel = tunnel;
|
||||
}
|
||||
else if (tunnel)
|
||||
tunnel->FlushTunnelDataMsgs ();
|
||||
}
|
||||
while (msg);
|
||||
}
|
||||
|
||||
uint64_t ts = i2p::util::GetSecondsSinceEpoch ();
|
||||
|
||||
Reference in New Issue
Block a user