From 1ecd5250fca0ab44bbbe90c5d25078daded80870 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 1 Nov 2016 17:49:42 -0400 Subject: [PATCH] eliminate overhead --- TunnelPool.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TunnelPool.cpp b/TunnelPool.cpp index 592610c2..56d72bfb 100644 --- a/TunnelPool.cpp +++ b/TunnelPool.cpp @@ -10,7 +10,9 @@ #include "Tunnel.h" #include "TunnelPool.h" #include "Destination.h" +#ifdef WITH_EVENTS #include "Event.h" +#endif namespace i2p { @@ -71,7 +73,9 @@ namespace tunnel { if (!m_IsActive) return; { +#ifdef WITH_EVENTS EmitTunnelEvent("tunnels.created", createdTunnel); +#endif std::unique_lock l(m_InboundTunnelsMutex); m_InboundTunnels.insert (createdTunnel); } @@ -83,7 +87,9 @@ namespace tunnel { if (expiredTunnel) { +#ifdef WITH_EVENTS EmitTunnelEvent("tunnels.expired", expiredTunnel); +#endif expiredTunnel->SetTunnelPool (nullptr); for (auto& it: m_Tests) if (it.second.second == expiredTunnel) it.second.second = nullptr; @@ -97,7 +103,9 @@ namespace tunnel { if (!m_IsActive) return; { +#ifdef WITH_EVENTS EmitTunnelEvent("tunnels.created", createdTunnel); +#endif std::unique_lock l(m_OutboundTunnelsMutex); m_OutboundTunnels.insert (createdTunnel); } @@ -108,7 +116,9 @@ namespace tunnel { if (expiredTunnel) { +#ifdef WITH_EVENTS EmitTunnelEvent("tunnels.expired", expiredTunnel); +#endif expiredTunnel->SetTunnelPool (nullptr); for (auto& it: m_Tests) if (it.second.first == expiredTunnel) it.second.first = nullptr;