mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
don't publish non-reachable router
This commit is contained in:
parent
4b421d3feb
commit
de82b3ae19
@ -1241,10 +1241,23 @@ namespace i2p
|
|||||||
void RouterContext::ScheduleInitialPublish ()
|
void RouterContext::ScheduleInitialPublish ()
|
||||||
{
|
{
|
||||||
m_PublishTimer.expires_from_now (boost::posix_time::seconds(ROUTER_INFO_INITIAL_PUBLISH_INTERVAL));
|
m_PublishTimer.expires_from_now (boost::posix_time::seconds(ROUTER_INFO_INITIAL_PUBLISH_INTERVAL));
|
||||||
m_PublishTimer.async_wait (std::bind (&RouterContext::HandlePublishTimer,
|
m_PublishTimer.async_wait (std::bind (&RouterContext::HandleInitialPublishTimer,
|
||||||
this, std::placeholders::_1));
|
this, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RouterContext::HandleInitialPublishTimer (const boost::system::error_code& ecode)
|
||||||
|
{
|
||||||
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
|
{
|
||||||
|
if (m_RouterInfo.IsReachableBy (i2p::data::RouterInfo::eAllTransports))
|
||||||
|
HandlePublishTimer (ecode);
|
||||||
|
else if (!ecode)
|
||||||
|
ScheduleInitialPublish ();
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "Router: initial publish timer error ", ecode.message ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RouterContext::SchedulePublish ()
|
void RouterContext::SchedulePublish ()
|
||||||
{
|
{
|
||||||
m_PublishTimer.cancel ();
|
m_PublishTimer.cancel ();
|
||||||
@ -1267,7 +1280,10 @@ namespace i2p
|
|||||||
}
|
}
|
||||||
UpdateTimestamp (i2p::util::GetSecondsSinceEpoch ());
|
UpdateTimestamp (i2p::util::GetSecondsSinceEpoch ());
|
||||||
Publish ();
|
Publish ();
|
||||||
|
if (!ecode)
|
||||||
SchedulePublishResend ();
|
SchedulePublishResend ();
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "Router: publish timer error ", ecode.message ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,7 +1340,10 @@ namespace i2p
|
|||||||
{
|
{
|
||||||
i2p::context.UpdateTimestamp (i2p::util::GetSecondsSinceEpoch ());
|
i2p::context.UpdateTimestamp (i2p::util::GetSecondsSinceEpoch ());
|
||||||
Publish ();
|
Publish ();
|
||||||
|
if (!ecode)
|
||||||
SchedulePublishResend ();
|
SchedulePublishResend ();
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "Router: publish resend timer error ", ecode.message ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,6 +197,7 @@ namespace garlic
|
|||||||
void PostDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg);
|
void PostDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg);
|
||||||
|
|
||||||
void ScheduleInitialPublish ();
|
void ScheduleInitialPublish ();
|
||||||
|
void HandleInitialPublishTimer (const boost::system::error_code& ecode);
|
||||||
void SchedulePublish ();
|
void SchedulePublish ();
|
||||||
void HandlePublishTimer (const boost::system::error_code& ecode);
|
void HandlePublishTimer (const boost::system::error_code& ecode);
|
||||||
void Publish ();
|
void Publish ();
|
||||||
|
Loading…
Reference in New Issue
Block a user