|
|
@ -31,6 +31,9 @@ namespace tunnel |
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef WITH_EVENTS |
|
|
|
#ifdef WITH_EVENTS |
|
|
|
EmitEvent({{"type", ev}, {"tid", std::to_string(t->GetTunnelID())}}); |
|
|
|
EmitEvent({{"type", ev}, {"tid", std::to_string(t->GetTunnelID())}}); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
(void) ev; |
|
|
|
|
|
|
|
(void) t; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -39,6 +42,10 @@ namespace tunnel |
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef WITH_EVENTS |
|
|
|
#ifdef WITH_EVENTS |
|
|
|
EmitEvent({{"type", ev}, {"tid", std::to_string(t->GetTunnelID())}, {"value", std::to_string(val)}, {"inbound", std::to_string(t->IsInbound())}}); |
|
|
|
EmitEvent({{"type", ev}, {"tid", std::to_string(t->GetTunnelID())}, {"value", std::to_string(val)}, {"inbound", std::to_string(t->IsInbound())}}); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
(void) ev; |
|
|
|
|
|
|
|
(void) t; |
|
|
|
|
|
|
|
(void) val; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -47,6 +54,10 @@ namespace tunnel |
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef WITH_EVENTS |
|
|
|
#ifdef WITH_EVENTS |
|
|
|
EmitEvent({{"type", ev}, {"tid", std::to_string(t->GetTunnelID())}, {"value", val}, {"inbound", std::to_string(t->IsInbound())}}); |
|
|
|
EmitEvent({{"type", ev}, {"tid", std::to_string(t->GetTunnelID())}, {"value", val}, {"inbound", std::to_string(t->IsInbound())}}); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
(void) ev; |
|
|
|
|
|
|
|
(void) t; |
|
|
|
|
|
|
|
(void) val; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -94,6 +105,7 @@ namespace tunnel |
|
|
|
bool IsFailed () const { return m_State == eTunnelStateFailed; }; |
|
|
|
bool IsFailed () const { return m_State == eTunnelStateFailed; }; |
|
|
|
bool IsRecreated () const { return m_IsRecreated; }; |
|
|
|
bool IsRecreated () const { return m_IsRecreated; }; |
|
|
|
void SetIsRecreated () { m_IsRecreated = true; }; |
|
|
|
void SetIsRecreated () { m_IsRecreated = true; }; |
|
|
|
|
|
|
|
virtual bool IsInbound() const = 0; |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<TunnelPool> GetTunnelPool () const { return m_Pool; }; |
|
|
|
std::shared_ptr<TunnelPool> GetTunnelPool () const { return m_Pool; }; |
|
|
|
void SetTunnelPool (std::shared_ptr<TunnelPool> pool) { m_Pool = pool; }; |
|
|
|
void SetTunnelPool (std::shared_ptr<TunnelPool> pool) { m_Pool = pool; }; |
|
|
@ -135,6 +147,8 @@ namespace tunnel |
|
|
|
// implements TunnelBase
|
|
|
|
// implements TunnelBase
|
|
|
|
void HandleTunnelDataMsg (std::shared_ptr<const i2p::I2NPMessage> tunnelMsg); |
|
|
|
void HandleTunnelDataMsg (std::shared_ptr<const i2p::I2NPMessage> tunnelMsg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool IsInbound() const { return false; } |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
|
|
|
|
|
|
|
|
std::mutex m_SendMutex; |
|
|
|
std::mutex m_SendMutex; |
|
|
@ -150,7 +164,7 @@ namespace tunnel |
|
|
|
void HandleTunnelDataMsg (std::shared_ptr<const I2NPMessage> msg); |
|
|
|
void HandleTunnelDataMsg (std::shared_ptr<const I2NPMessage> msg); |
|
|
|
virtual size_t GetNumReceivedBytes () const { return m_Endpoint.GetNumReceivedBytes (); }; |
|
|
|
virtual size_t GetNumReceivedBytes () const { return m_Endpoint.GetNumReceivedBytes (); }; |
|
|
|
void Print (std::stringstream& s) const; |
|
|
|
void Print (std::stringstream& s) const; |
|
|
|
|
|
|
|
bool IsInbound() const { return true; } |
|
|
|
private: |
|
|
|
private: |
|
|
|
|
|
|
|
|
|
|
|
TunnelEndpoint m_Endpoint; |
|
|
|
TunnelEndpoint m_Endpoint; |
|
|
|