diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 8a63658c..487e9c83 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -180,7 +180,18 @@ namespace http { case eRouterStatusOK: s << "OK"; break; case eRouterStatusTesting: s << "Testing"; break; case eRouterStatusFirewalled: s << "Firewalled"; break; - case eRouterStatusError: s << "Error"; break; + case eRouterStatusError: + { + s << "Error"; + switch (i2p::context.GetError ()) + { + case eRouterErrorClockSkew: + s << "
Clock skew"; + break; + default: ; + } + break; + } default: s << "Unknown"; } s << "
\r\n"; diff --git a/RouterContext.cpp b/RouterContext.cpp index c92b575b..6824adb8 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -18,7 +18,7 @@ namespace i2p RouterContext::RouterContext (): 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) { m_Status = status; + m_Error = eRouterErrorNone; switch (m_Status) { case eRouterStatusOK: diff --git a/RouterContext.h b/RouterContext.h index 23c03593..b89b3140 100644 --- a/RouterContext.h +++ b/RouterContext.h @@ -24,6 +24,12 @@ namespace i2p eRouterStatusError = 3 }; + enum RouterError + { + eRouterErrorNone = 0, + eRouterErrorClockSkew = 1 + }; + class RouterContext: public i2p::garlic::GarlicDestination { public: @@ -50,7 +56,9 @@ namespace i2p uint64_t GetBandwidthLimit () const { return m_BandwidthLimit; }; RouterStatus GetStatus () const { return m_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 UpdateAddress (const boost::asio::ip::address& host); // called from SSU or Daemon bool AddIntroducer (const i2p::data::RouterInfo::Introducer& introducer); @@ -108,6 +116,7 @@ namespace i2p uint64_t m_StartupTime; // in seconds since epoch uint32_t m_BandwidthLimit; // allowed bandwidth RouterStatus m_Status; + RouterError m_Error; std::mutex m_GarlicMutex; }; diff --git a/SSUSession.cpp b/SSUSession.cpp index ca714aed..5cd59164 100644 --- a/SSUSession.cpp +++ b/SSUSession.cpp @@ -279,7 +279,7 @@ namespace transport if (signedOnTime < ts - SSU_CLOCK_SKEW || signedOnTime > ts + SSU_CLOCK_SKEW) { 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