mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
add more websocket events
This commit is contained in:
parent
34f090662a
commit
93eca799dd
3 changed files with 59 additions and 7 deletions
|
@ -8,11 +8,14 @@
|
|||
#include "Transports.h"
|
||||
#include "Log.h"
|
||||
#include "TunnelPool.h"
|
||||
#include "Destination.h"
|
||||
#include "Event.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace tunnel
|
||||
{
|
||||
|
||||
TunnelPool::TunnelPool (int numInboundHops, int numOutboundHops, int numInboundTunnels, int numOutboundTunnels):
|
||||
m_NumInboundHops (numInboundHops), m_NumOutboundHops (numOutboundHops),
|
||||
m_NumInboundTunnels (numInboundTunnels), m_NumOutboundTunnels (numOutboundTunnels), m_IsActive (true),
|
||||
|
@ -67,6 +70,7 @@ namespace tunnel
|
|||
{
|
||||
if (!m_IsActive) return;
|
||||
{
|
||||
EmitTunnelEvent("tunnels.created", createdTunnel);
|
||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||
m_InboundTunnels.insert (createdTunnel);
|
||||
}
|
||||
|
@ -77,7 +81,9 @@ namespace tunnel
|
|||
void TunnelPool::TunnelExpired (std::shared_ptr<InboundTunnel> expiredTunnel)
|
||||
{
|
||||
if (expiredTunnel)
|
||||
{
|
||||
{
|
||||
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
||||
|
||||
expiredTunnel->SetTunnelPool (nullptr);
|
||||
for (auto& it: m_Tests)
|
||||
if (it.second.second == expiredTunnel) it.second.second = nullptr;
|
||||
|
@ -91,6 +97,7 @@ namespace tunnel
|
|||
{
|
||||
if (!m_IsActive) return;
|
||||
{
|
||||
EmitTunnelEvent("tunnels.created", createdTunnel);
|
||||
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
|
||||
m_OutboundTunnels.insert (createdTunnel);
|
||||
}
|
||||
|
@ -101,6 +108,8 @@ namespace tunnel
|
|||
{
|
||||
if (expiredTunnel)
|
||||
{
|
||||
EmitTunnelEvent("tunnels.expired", expiredTunnel);
|
||||
|
||||
expiredTunnel->SetTunnelPool (nullptr);
|
||||
for (auto& it: m_Tests)
|
||||
if (it.second.first == expiredTunnel) it.second.first = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue