mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
show error message in the web-console
This commit is contained in:
parent
783c2b6b03
commit
7a51407f6d
|
@ -180,7 +180,18 @@ namespace http {
|
||||||
case eRouterStatusOK: s << "OK"; break;
|
case eRouterStatusOK: s << "OK"; break;
|
||||||
case eRouterStatusTesting: s << "Testing"; break;
|
case eRouterStatusTesting: s << "Testing"; break;
|
||||||
case eRouterStatusFirewalled: s << "Firewalled"; break;
|
case eRouterStatusFirewalled: s << "Firewalled"; break;
|
||||||
case eRouterStatusError: s << "Error"; break;
|
case eRouterStatusError:
|
||||||
|
{
|
||||||
|
s << "Error";
|
||||||
|
switch (i2p::context.GetError ())
|
||||||
|
{
|
||||||
|
case eRouterErrorClockSkew:
|
||||||
|
s << "<br>Clock skew";
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: s << "Unknown";
|
default: s << "Unknown";
|
||||||
}
|
}
|
||||||
s << "<br>\r\n";
|
s << "<br>\r\n";
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace i2p
|
||||||
|
|
||||||
RouterContext::RouterContext ():
|
RouterContext::RouterContext ():
|
||||||
m_LastUpdateTime (0), m_AcceptsTunnels (true), m_IsFloodfill (false),
|
m_LastUpdateTime (0), m_AcceptsTunnels (true), m_IsFloodfill (false),
|
||||||
m_StartupTime (0), m_Status (eRouterStatusOK )
|
m_StartupTime (0), m_Status (eRouterStatusOK), m_Error (eRouterErrorNone)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ namespace i2p
|
||||||
if (status != m_Status)
|
if (status != m_Status)
|
||||||
{
|
{
|
||||||
m_Status = status;
|
m_Status = status;
|
||||||
|
m_Error = eRouterErrorNone;
|
||||||
switch (m_Status)
|
switch (m_Status)
|
||||||
{
|
{
|
||||||
case eRouterStatusOK:
|
case eRouterStatusOK:
|
||||||
|
|
|
@ -24,6 +24,12 @@ namespace i2p
|
||||||
eRouterStatusError = 3
|
eRouterStatusError = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum RouterError
|
||||||
|
{
|
||||||
|
eRouterErrorNone = 0,
|
||||||
|
eRouterErrorClockSkew = 1
|
||||||
|
};
|
||||||
|
|
||||||
class RouterContext: public i2p::garlic::GarlicDestination
|
class RouterContext: public i2p::garlic::GarlicDestination
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -50,6 +56,8 @@ namespace i2p
|
||||||
uint64_t GetBandwidthLimit () const { return m_BandwidthLimit; };
|
uint64_t GetBandwidthLimit () const { return m_BandwidthLimit; };
|
||||||
RouterStatus GetStatus () const { return m_Status; };
|
RouterStatus GetStatus () const { return m_Status; };
|
||||||
void SetStatus (RouterStatus status);
|
void SetStatus (RouterStatus status);
|
||||||
|
RouterError GetError () const { return m_Error; };
|
||||||
|
void SetError (RouterError error) { m_Status = eRouterStatusError; m_Error = error; };
|
||||||
|
|
||||||
void UpdatePort (int port); // called from Daemon
|
void UpdatePort (int port); // called from Daemon
|
||||||
void UpdateAddress (const boost::asio::ip::address& host); // called from SSU or Daemon
|
void UpdateAddress (const boost::asio::ip::address& host); // called from SSU or Daemon
|
||||||
|
@ -108,6 +116,7 @@ namespace i2p
|
||||||
uint64_t m_StartupTime; // in seconds since epoch
|
uint64_t m_StartupTime; // in seconds since epoch
|
||||||
uint32_t m_BandwidthLimit; // allowed bandwidth
|
uint32_t m_BandwidthLimit; // allowed bandwidth
|
||||||
RouterStatus m_Status;
|
RouterStatus m_Status;
|
||||||
|
RouterError m_Error;
|
||||||
std::mutex m_GarlicMutex;
|
std::mutex m_GarlicMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ namespace transport
|
||||||
if (signedOnTime < ts - SSU_CLOCK_SKEW || signedOnTime > ts + SSU_CLOCK_SKEW)
|
if (signedOnTime < ts - SSU_CLOCK_SKEW || signedOnTime > ts + SSU_CLOCK_SKEW)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "SSU: clock skew detected ", (int)ts - signedOnTime, ". Check your clock");
|
LogPrint (eLogError, "SSU: clock skew detected ", (int)ts - signedOnTime, ". Check your clock");
|
||||||
i2p::context.SetStatus (eRouterStatusError);
|
i2p::context.SetError (eRouterErrorClockSkew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
payload += 4; // signed on time
|
payload += 4; // signed on time
|
||||||
|
|
Loading…
Reference in a new issue