mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
TransitTunnelParticipant
This commit is contained in:
parent
46a36f766f
commit
2ab0ff8aea
4 changed files with 92 additions and 40 deletions
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 ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue