mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
eliminate overhead
This commit is contained in:
parent
44af5e04e4
commit
1ecd5250fc
@ -10,7 +10,9 @@
|
|||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
#include "TunnelPool.h"
|
#include "TunnelPool.h"
|
||||||
#include "Destination.h"
|
#include "Destination.h"
|
||||||
|
#ifdef WITH_EVENTS
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
@ -71,7 +73,9 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
if (!m_IsActive) return;
|
if (!m_IsActive) return;
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_EVENTS
|
||||||
EmitTunnelEvent("tunnels.created", createdTunnel);
|
EmitTunnelEvent("tunnels.created", createdTunnel);
|
||||||
|
#endif
|
||||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||||
m_InboundTunnels.insert (createdTunnel);
|
m_InboundTunnels.insert (createdTunnel);
|
||||||
}
|
}
|
||||||
@ -83,7 +87,9 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
if (expiredTunnel)
|
if (expiredTunnel)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_EVENTS
|
||||||
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
||||||
|
#endif
|
||||||
expiredTunnel->SetTunnelPool (nullptr);
|
expiredTunnel->SetTunnelPool (nullptr);
|
||||||
for (auto& it: m_Tests)
|
for (auto& it: m_Tests)
|
||||||
if (it.second.second == expiredTunnel) it.second.second = nullptr;
|
if (it.second.second == expiredTunnel) it.second.second = nullptr;
|
||||||
@ -97,7 +103,9 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
if (!m_IsActive) return;
|
if (!m_IsActive) return;
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_EVENTS
|
||||||
EmitTunnelEvent("tunnels.created", createdTunnel);
|
EmitTunnelEvent("tunnels.created", createdTunnel);
|
||||||
|
#endif
|
||||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||||
m_OutboundTunnels.insert (createdTunnel);
|
m_OutboundTunnels.insert (createdTunnel);
|
||||||
}
|
}
|
||||||
@ -108,7 +116,9 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
if (expiredTunnel)
|
if (expiredTunnel)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_EVENTS
|
||||||
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
||||||
|
#endif
|
||||||
expiredTunnel->SetTunnelPool (nullptr);
|
expiredTunnel->SetTunnelPool (nullptr);
|
||||||
for (auto& it: m_Tests)
|
for (auto& it: m_Tests)
|
||||||
if (it.second.first == expiredTunnel) it.second.first = nullptr;
|
if (it.second.first == expiredTunnel) it.second.first = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user