diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index 2d6800b4..862d6e4a 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013-2023, The PurpleI2P Project
+* Copyright (c) 2013-2024, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
@@ -133,23 +133,19 @@ namespace http {
static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, bool explr, int bytes)
{
std::string state, stateText;
- switch (eState) {
+ switch (eState)
+ {
case i2p::tunnel::eTunnelStateBuildReplyReceived :
case i2p::tunnel::eTunnelStatePending : state = "building"; break;
- case i2p::tunnel::eTunnelStateBuildFailed :
- case i2p::tunnel::eTunnelStateTestFailed :
+ case i2p::tunnel::eTunnelStateBuildFailed : state = "failed"; stateText = "declined"; break;
+ case i2p::tunnel::eTunnelStateTestFailed : state = "failed"; stateText = "test failed"; break;
case i2p::tunnel::eTunnelStateFailed : state = "failed"; break;
case i2p::tunnel::eTunnelStateExpiring : state = "expiring"; break;
case i2p::tunnel::eTunnelStateEstablished : state = "established"; break;
default: state = "unknown"; break;
}
-
- if (state == "building") stateText = tr("building");
- else if (state == "failed") stateText = tr("failed");
- else if (state == "expiring") stateText = tr("expiring");
- else if (state == "established") stateText = tr("established");
- else stateText = tr("unknown");
-
+ if (stateText.empty ()) stateText = tr(state);
+
s << " " << stateText << ((explr) ? " (" + tr("exploratory") + ")" : "") << ", ";
ShowTraffic(s, bytes);
s << "\r\n";
diff --git a/libi2pd/Tunnel.cpp b/libi2pd/Tunnel.cpp
index b578217f..d46da5b9 100644
--- a/libi2pd/Tunnel.cpp
+++ b/libi2pd/Tunnel.cpp
@@ -250,7 +250,7 @@ namespace tunnel
void InboundTunnel::HandleTunnelDataMsg (std::shared_ptr&& msg)
{
- if (IsFailed ()) SetState (eTunnelStateEstablished); // incoming messages means a tunnel is alive
+ if (GetState () != eTunnelStateExpiring) SetState (eTunnelStateEstablished); // incoming messages means a tunnel is alive
EncryptTunnelMsg (msg, msg);
msg->from = GetSharedFromThis ();
m_Endpoint.HandleDecryptedTunnelDataMsg (msg);
diff --git a/libi2pd/TunnelPool.cpp b/libi2pd/TunnelPool.cpp
index 93df99be..dc43a025 100644
--- a/libi2pd/TunnelPool.cpp
+++ b/libi2pd/TunnelPool.cpp
@@ -461,7 +461,7 @@ namespace tunnel
// restore from test failed state if any
if (test.first)
{
- if (test.first->GetState () == eTunnelStateTestFailed)
+ if (test.first->GetState () != eTunnelStateExpiring)
test.first->SetState (eTunnelStateEstablished);
// update latency
uint64_t latency = 0;
@@ -471,7 +471,7 @@ namespace tunnel
}
if (test.second)
{
- if (test.second->GetState () == eTunnelStateTestFailed)
+ if (test.second->GetState () != eTunnelStateExpiring)
test.second->SetState (eTunnelStateEstablished);
// update latency
uint64_t latency = 0;