Browse Source

show error message in the web-console

pull/642/head
orignal 8 years ago
parent
commit
7a51407f6d
  1. 13
      HTTPServer.cpp
  2. 3
      RouterContext.cpp
  3. 9
      RouterContext.h
  4. 2
      SSUSession.cpp

13
HTTPServer.cpp

@ -180,7 +180,18 @@ namespace http { @@ -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 << "<br>Clock skew";
break;
default: ;
}
break;
}
default: s << "Unknown";
}
s << "<br>\r\n";

3
RouterContext.cpp

@ -18,7 +18,7 @@ namespace i2p @@ -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 @@ -95,6 +95,7 @@ namespace i2p
if (status != m_Status)
{
m_Status = status;
m_Error = eRouterErrorNone;
switch (m_Status)
{
case eRouterStatusOK:

9
RouterContext.h

@ -24,6 +24,12 @@ namespace i2p @@ -24,6 +24,12 @@ namespace i2p
eRouterStatusError = 3
};
enum RouterError
{
eRouterErrorNone = 0,
eRouterErrorClockSkew = 1
};
class RouterContext: public i2p::garlic::GarlicDestination
{
public:
@ -50,6 +56,8 @@ namespace i2p @@ -50,6 +56,8 @@ 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
@ -108,6 +116,7 @@ namespace i2p @@ -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;
};

2
SSUSession.cpp

@ -279,7 +279,7 @@ namespace transport @@ -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

Loading…
Cancel
Save