mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-22 17:31:32 +00:00
retry publishing LeaseSet if no floodfills or tunnels
This commit is contained in:
1 parent
466e99fa55
commit
39b2f82c24
2 files changed
+16
-7
No files matched your search
+14
-7
@@ -666,6 +666,8 @@ namespace client
|
||||
{
|
||||
LogPrint (eLogError, "Destination: Can't publish LeaseSet, no more floodfills found");
|
||||
m_ExcludedFloodfills.clear ();
|
||||
// try again later
|
||||
SchedulePublishRetry ();
|
||||
return;
|
||||
}
|
||||
auto outbound = m_Pool->GetNextOutboundTunnel (nullptr, floodfill->GetCompatibleTransports (false));
|
||||
@@ -698,13 +700,8 @@ namespace client
|
||||
if (!floodfill || !outbound || !inbound)
|
||||
{
|
||||
// we can't publish now
|
||||
m_ExcludedFloodfills.clear ();
|
||||
m_PublishReplyToken = 1; // dummy non-zero value
|
||||
// try again after a while
|
||||
LogPrint (eLogInfo, "Destination: Can't publish LeaseSet because destination is not ready. Try publishing again after ", PUBLISH_CONFIRMATION_TIMEOUT, " milliseconds");
|
||||
m_PublishConfirmationTimer.expires_after (std::chrono::milliseconds(PUBLISH_CONFIRMATION_TIMEOUT));
|
||||
m_PublishConfirmationTimer.async_wait (std::bind (&LeaseSetDestination::HandlePublishConfirmationTimer,
|
||||
shared_from_this (), std::placeholders::_1, PUBLISH_CONFIRMATION_TIMEOUT));
|
||||
// try again layer
|
||||
SchedulePublishRetry ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -733,6 +730,16 @@ namespace client
|
||||
m_LastSubmissionTime = ts;
|
||||
}
|
||||
|
||||
void LeaseSetDestination::SchedulePublishRetry ()
|
||||
{
|
||||
m_ExcludedFloodfills.clear ();
|
||||
m_PublishReplyToken = 1; // dummy non-zero value
|
||||
LogPrint (eLogInfo, "Destination: Can't publish LeaseSet because destination is not ready. Try publishing again after ", PUBLISH_CONFIRMATION_TIMEOUT, " milliseconds");
|
||||
m_PublishConfirmationTimer.expires_after (std::chrono::milliseconds(PUBLISH_RETRY_INTERVAL));
|
||||
m_PublishConfirmationTimer.async_wait (std::bind (&LeaseSetDestination::HandlePublishConfirmationTimer,
|
||||
shared_from_this (), std::placeholders::_1, PUBLISH_RETRY_INTERVAL));
|
||||
}
|
||||
|
||||
void LeaseSetDestination::HandlePublishConfirmationTimer (const boost::system::error_code& ecode, uint64_t publishConfirmationTimeout)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace client
|
||||
const uint8_t PROTOCOL_TYPE_DATAGRAM2 = 19;
|
||||
const uint8_t PROTOCOL_TYPE_DATAGRAM3 = 20;
|
||||
const int PUBLISH_CONFIRMATION_TIMEOUT = 1400; // in milliseconds
|
||||
const int PUBLISH_RETRY_INTERVAL = 11200; // in milliseconds
|
||||
const int PUBLISH_VERIFICATION_TIMEOUT = 5; // in seconds after successful publish
|
||||
const int PUBLISH_VERIFICATION_TIMEOUT_VARIANCE = 3; // in seconds
|
||||
const int PUBLISH_MIN_INTERVAL = 20; // in seconds
|
||||
@@ -196,6 +197,7 @@ namespace client
|
||||
|
||||
std::shared_ptr<const i2p::data::LocalLeaseSet> GetLeaseSetMt ();
|
||||
void Publish ();
|
||||
void SchedulePublishRetry ();
|
||||
void HandlePublishConfirmationTimer (const boost::system::error_code& ecode, uint64_t publishConfirmationTimeout);
|
||||
void HandlePublishVerificationTimer (const boost::system::error_code& ecode);
|
||||
void HandlePublishDelayTimer (const boost::system::error_code& ecode);
|
||||
|
||||
Reference in new issue
Block a user