Browse Source

reduce explratory tunnels quatity to 3

pull/697/merge
orignal 8 years ago
parent
commit
9d8d4c09c6
  1. 17
      Tunnel.cpp

17
Tunnel.cpp

@ -12,6 +12,9 @@
#include "NetDb.h" #include "NetDb.h"
#include "Tunnel.h" #include "Tunnel.h"
#include "TunnelPool.h" #include "TunnelPool.h"
#ifdef WITH_EVENTS
#include "Event.h"
#endif
namespace i2p namespace i2p
{ {
@ -194,7 +197,9 @@ namespace tunnel
void Tunnel::SetState(TunnelState state) void Tunnel::SetState(TunnelState state)
{ {
m_State = state; m_State = state;
#ifdef WITH_EVENTS
EmitTunnelEvent("tunnel.state", this, state); EmitTunnelEvent("tunnel.state", this, state);
#endif
} }
@ -598,7 +603,9 @@ namespace tunnel
hop = hop->next; hop = hop->next;
} }
} }
#ifdef WITH_EVENTS
EmitTunnelEvent("tunnel.state", tunnel.get(), eTunnelStateBuildFailed); EmitTunnelEvent("tunnel.state", tunnel.get(), eTunnelStateBuildFailed);
#endif
// delete // delete
it = pendingTunnels.erase (it); it = pendingTunnels.erase (it);
m_NumFailedTunnelCreations++; m_NumFailedTunnelCreations++;
@ -608,9 +615,9 @@ namespace tunnel
break; break;
case eTunnelStateBuildFailed: case eTunnelStateBuildFailed:
LogPrint (eLogDebug, "Tunnel: pending build request ", it->first, " failed, deleted"); LogPrint (eLogDebug, "Tunnel: pending build request ", it->first, " failed, deleted");
#ifdef WITH_EVENTS
EmitTunnelEvent("tunnel.state", tunnel.get(), eTunnelStateBuildFailed); EmitTunnelEvent("tunnel.state", tunnel.get(), eTunnelStateBuildFailed);
#endif
it = pendingTunnels.erase (it); it = pendingTunnels.erase (it);
m_NumFailedTunnelCreations++; m_NumFailedTunnelCreations++;
break; break;
@ -661,7 +668,7 @@ namespace tunnel
} }
} }
if (m_OutboundTunnels.size () < 5) if (m_OutboundTunnels.size () < 3)
{ {
// trying to create one more oubound tunnel // trying to create one more oubound tunnel
auto inboundTunnel = GetNextInboundTunnel (); auto inboundTunnel = GetNextInboundTunnel ();
@ -720,13 +727,13 @@ namespace tunnel
CreateZeroHopsOutboundTunnel (); CreateZeroHopsOutboundTunnel ();
if (!m_ExploratoryPool) if (!m_ExploratoryPool)
{ {
m_ExploratoryPool = CreateTunnelPool (2, 2, 5, 5); // 2-hop exploratory, 5 tunnels m_ExploratoryPool = CreateTunnelPool (2, 2, 3, 3); // 2-hop exploratory, 3 tunnels
m_ExploratoryPool->SetLocalDestination (i2p::context.GetSharedDestination ()); m_ExploratoryPool->SetLocalDestination (i2p::context.GetSharedDestination ());
} }
return; return;
} }
if (m_OutboundTunnels.empty () || m_InboundTunnels.size () < 5) if (m_OutboundTunnels.empty () || m_InboundTunnels.size () < 3)
{ {
// trying to create one more inbound tunnel // trying to create one more inbound tunnel
auto router = i2p::transport::transports.RoutesRestricted() ? auto router = i2p::transport::transports.RoutesRestricted() ?

Loading…
Cancel
Save