mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-22 03:40:33 +00:00
try to reseed again after 30 second if failed
This commit is contained in:
+17
-3
@@ -75,9 +75,23 @@ namespace data
|
||||
}
|
||||
else // bootstrap from reseed servers
|
||||
{
|
||||
int num = ReseedFromServers ();
|
||||
if (num == 0)
|
||||
LogPrint (eLogWarning, "Reseed: Failed to reseed from servers");
|
||||
auto start = i2p::util::GetMonotonicSeconds ();
|
||||
int num = 0;
|
||||
while (!num)
|
||||
{
|
||||
num = ReseedFromServers ();
|
||||
if (num) break; // success
|
||||
|
||||
if (i2p::util::GetMonotonicSeconds () < start + RESEED_GIVEUP_TIMEOUT)
|
||||
{
|
||||
LogPrint (eLogWarning, "Reseed: Failed to reseed from servers. Waiting for ", RESEED_WAITING_INTERVAL, " seconds");
|
||||
std::this_thread::sleep_for (std::chrono::seconds(RESEED_WAITING_INTERVAL));
|
||||
}
|
||||
else
|
||||
break; // give up
|
||||
}
|
||||
if (!num)
|
||||
LogPrint (eLogWarning, "Reseed: Failed to reseed from servers. Give up");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2025, The PurpleI2P Project
|
||||
* Copyright (c) 2013-2026, The PurpleI2P Project
|
||||
*
|
||||
* This file is part of Purple i2pd project and licensed under BSD3
|
||||
*
|
||||
@@ -22,6 +22,8 @@ namespace data
|
||||
{
|
||||
constexpr int MAX_NUM_RESEED_ATTEMPTS = 10;
|
||||
constexpr int RESEED_CONNECT_TIMEOUT = 5; // in seconds
|
||||
constexpr int RESEED_WAITING_INTERVAL = 30; // in second
|
||||
constexpr int RESEED_GIVEUP_TIMEOUT = 180; // in seconds
|
||||
|
||||
class Reseeder
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user