mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
separate network status and errors
This commit is contained in:
parent
36eddd48c3
commit
8fd466c5a9
|
@ -232,26 +232,25 @@ namespace http {
|
||||||
case eRouterStatusUnknown: s << tr("Unknown"); break;
|
case eRouterStatusUnknown: s << tr("Unknown"); break;
|
||||||
case eRouterStatusProxy: s << tr("Proxy"); break;
|
case eRouterStatusProxy: s << tr("Proxy"); break;
|
||||||
case eRouterStatusMesh: s << tr("Mesh"); break;
|
case eRouterStatusMesh: s << tr("Mesh"); break;
|
||||||
case eRouterStatusError:
|
|
||||||
{
|
|
||||||
s << tr("Error");
|
|
||||||
switch (error)
|
|
||||||
{
|
|
||||||
case eRouterErrorClockSkew:
|
|
||||||
s << " - " << tr("Clock skew");
|
|
||||||
break;
|
|
||||||
case eRouterErrorOffline:
|
|
||||||
s << " - " << tr("Offline");
|
|
||||||
break;
|
|
||||||
case eRouterErrorSymmetricNAT:
|
|
||||||
s << " - " << tr("Symmetric NAT");
|
|
||||||
break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: s << tr("Unknown");
|
default: s << tr("Unknown");
|
||||||
}
|
}
|
||||||
|
if (error != eRouterErrorNone)
|
||||||
|
{
|
||||||
|
s << "<br>";
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case eRouterErrorClockSkew:
|
||||||
|
s << " - " << tr("Clock skew");
|
||||||
|
break;
|
||||||
|
case eRouterErrorOffline:
|
||||||
|
s << " - " << tr("Offline");
|
||||||
|
break;
|
||||||
|
case eRouterErrorSymmetricNAT:
|
||||||
|
s << " - " << tr("Symmetric NAT");
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowStatus (std::stringstream& s, bool includeHiddenContent, i2p::http::OutputFormatEnum outputFormat)
|
void ShowStatus (std::stringstream& s, bool includeHiddenContent, i2p::http::OutputFormatEnum outputFormat)
|
||||||
|
|
|
@ -37,10 +37,9 @@ namespace garlic
|
||||||
eRouterStatusOK = 0,
|
eRouterStatusOK = 0,
|
||||||
eRouterStatusTesting = 1,
|
eRouterStatusTesting = 1,
|
||||||
eRouterStatusFirewalled = 2,
|
eRouterStatusFirewalled = 2,
|
||||||
eRouterStatusError = 3,
|
eRouterStatusUnknown = 3,
|
||||||
eRouterStatusUnknown = 4,
|
eRouterStatusProxy = 4,
|
||||||
eRouterStatusProxy = 5,
|
eRouterStatusMesh = 5
|
||||||
eRouterStatusMesh = 6
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RouterError
|
enum RouterError
|
||||||
|
@ -105,12 +104,12 @@ namespace garlic
|
||||||
void SetStatus (RouterStatus status);
|
void SetStatus (RouterStatus status);
|
||||||
void SetStatusSSU2 (RouterStatus status);
|
void SetStatusSSU2 (RouterStatus status);
|
||||||
RouterError GetError () const { return m_Error; };
|
RouterError GetError () const { return m_Error; };
|
||||||
void SetError (RouterError error) { m_Status = eRouterStatusError; m_Error = error; };
|
void SetError (RouterError error) { m_Error = error; };
|
||||||
RouterStatus GetStatusV6 () const { return m_StatusV6; };
|
RouterStatus GetStatusV6 () const { return m_StatusV6; };
|
||||||
void SetStatusV6 (RouterStatus status);
|
void SetStatusV6 (RouterStatus status);
|
||||||
void SetStatusV6SSU2 (RouterStatus status);
|
void SetStatusV6SSU2 (RouterStatus status);
|
||||||
RouterError GetErrorV6 () const { return m_ErrorV6; };
|
RouterError GetErrorV6 () const { return m_ErrorV6; };
|
||||||
void SetErrorV6 (RouterError error) { m_StatusV6 = eRouterStatusError; m_ErrorV6 = error; };
|
void SetErrorV6 (RouterError error) { m_ErrorV6 = error; };
|
||||||
int GetNetID () const { return m_NetID; };
|
int GetNetID () const { return m_NetID; };
|
||||||
void SetNetID (int netID) { m_NetID = netID; };
|
void SetNetID (int netID) { m_NetID = netID; };
|
||||||
bool DecryptTunnelBuildRecord (const uint8_t * encrypted, uint8_t * data);
|
bool DecryptTunnelBuildRecord (const uint8_t * encrypted, uint8_t * data);
|
||||||
|
|
|
@ -1571,13 +1571,13 @@ namespace transport
|
||||||
{
|
{
|
||||||
if (isV4)
|
if (isV4)
|
||||||
{
|
{
|
||||||
if (i2p::context.GetStatus () == eRouterStatusError && i2p::context.GetError () == eRouterErrorSymmetricNAT)
|
if (i2p::context.GetError () == eRouterErrorSymmetricNAT)
|
||||||
i2p::context.SetStatus (eRouterStatusTesting);
|
i2p::context.SetError (eRouterErrorNone);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (i2p::context.GetStatusV6 () == eRouterStatusError && i2p::context.GetErrorV6 () == eRouterErrorSymmetricNAT)
|
if (i2p::context.GetErrorV6 () == eRouterErrorSymmetricNAT)
|
||||||
i2p::context.SetStatusV6 (eRouterStatusTesting);
|
i2p::context.SetErrorV6 (eRouterErrorNone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -719,8 +719,8 @@ namespace transport
|
||||||
if (i2p::context.GetStatus () == eRouterStatusTesting)
|
if (i2p::context.GetStatus () == eRouterStatusTesting)
|
||||||
i2p::context.SetError (eRouterErrorSymmetricNAT);
|
i2p::context.SetError (eRouterErrorSymmetricNAT);
|
||||||
}
|
}
|
||||||
else if (i2p::context.GetStatus () == eRouterStatusError && i2p::context.GetError () == eRouterErrorSymmetricNAT)
|
else if (i2p::context.GetError () == eRouterErrorSymmetricNAT)
|
||||||
i2p::context.SetStatus (eRouterStatusTesting);
|
i2p::context.SetError (eRouterErrorNone);
|
||||||
}
|
}
|
||||||
uint32_t nonce = bufbe32toh (buf);
|
uint32_t nonce = bufbe32toh (buf);
|
||||||
buf += 4; // nonce
|
buf += 4; // nonce
|
||||||
|
|
Loading…
Reference in a new issue