Browse Source

fixed crash

pull/308/head
orignal 9 years ago
parent
commit
a7b8b52dbd
  1. 8
      HTTPServer.cpp
  2. 13
      Tunnel.cpp
  3. 2
      Tunnel.h

8
HTTPServer.cpp

@ -800,7 +800,7 @@ namespace util @@ -800,7 +800,7 @@ namespace util
for (auto it: i2p::tunnel::tunnels.GetOutboundTunnels ())
{
it->GetTunnelConfig ()->Print (s);
it->Print (s);
auto state = it->GetState ();
if (state == i2p::tunnel::eTunnelStateFailed)
s << " " << "Failed";
@ -812,7 +812,7 @@ namespace util @@ -812,7 +812,7 @@ namespace util
for (auto it: i2p::tunnel::tunnels.GetInboundTunnels ())
{
it.second->GetTunnelConfig ()->Print (s);
it.second->Print (s);
auto state = it.second->GetState ();
if (state == i2p::tunnel::eTunnelStateFailed)
s << " " << "Failed";
@ -863,7 +863,7 @@ namespace util @@ -863,7 +863,7 @@ namespace util
s << "<b>Tunnels:</b><br>";
for (auto it: pool->GetOutboundTunnels ())
{
it->GetTunnelConfig ()->Print (s);
it->Print (s);
auto state = it->GetState ();
if (state == i2p::tunnel::eTunnelStateFailed)
s << " " << "Failed";
@ -873,7 +873,7 @@ namespace util @@ -873,7 +873,7 @@ namespace util
}
for (auto it: pool->GetInboundTunnels ())
{
it->GetTunnelConfig ()->Print (s);
it->Print (s);
auto state = it->GetState ();
if (state == i2p::tunnel::eTunnelStateFailed)
s << " " << "Failed";

13
Tunnel.cpp

@ -190,6 +190,13 @@ namespace tunnel @@ -190,6 +190,13 @@ namespace tunnel
newMsg->from = shared_from_this ();
m_Endpoint.HandleDecryptedTunnelDataMsg (newMsg);
}
void InboundTunnel::Print (std::stringstream& s) const
{
s << "-->" << i2p::data::GetIdentHashAbbreviation (GetNextIdentHash ()) << ":" << GetNextTunnelID ();
s << "-->" << (GetNumHops () - 1) << " hops ";
s << GetTunnelID () << ":me";
}
void OutboundTunnel::SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, std::shared_ptr<i2p::I2NPMessage> msg)
{
@ -225,6 +232,12 @@ namespace tunnel @@ -225,6 +232,12 @@ namespace tunnel
{
LogPrint (eLogError, "Incoming message for outbound tunnel ", GetTunnelID ());
}
void OutboundTunnel::Print (std::stringstream& s) const
{
s << "me-->" << i2p::data::GetIdentHashAbbreviation (GetNextIdentHash ()) << ":" << GetNextTunnelID ();
s << "-->" << (GetNumHops () - 1) << " hops-->";
}
Tunnels tunnels;

2
Tunnel.h

@ -97,6 +97,7 @@ namespace tunnel @@ -97,6 +97,7 @@ namespace tunnel
void SendTunnelDataMsg (const std::vector<TunnelMessageBlock>& msgs); // multiple messages
const i2p::data::IdentHash& GetEndpointIdentHash () const { return m_EndpointIdentHash; };
size_t GetNumSentBytes () const { return m_Gateway.GetNumSentBytes (); };
void Print (std::stringstream& s) const;
// implements TunnelBase
void HandleTunnelDataMsg (std::shared_ptr<const i2p::I2NPMessage> tunnelMsg);
@ -115,6 +116,7 @@ namespace tunnel @@ -115,6 +116,7 @@ namespace tunnel
InboundTunnel (std::shared_ptr<const TunnelConfig> config): Tunnel (config), m_Endpoint (true) {};
void HandleTunnelDataMsg (std::shared_ptr<const I2NPMessage> msg);
size_t GetNumReceivedBytes () const { return m_Endpoint.GetNumReceivedBytes (); };
void Print (std::stringstream& s) const;
private:

Loading…
Cancel
Save