Crude attempt at retrying lokid connection

pull/1318/head
Stephen Shelton 4 years ago
parent 1d9c337021
commit 4699280d97
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

@ -222,7 +222,31 @@ namespace llarp
return false;
#endif
#endif
_identity = RpcClient()->ObtainIdentityKey();
constexpr int maxTries = 5;
int numTries = 0;
while (numTries < maxTries)
{
numTries++;
try
{
_identity = RpcClient()->ObtainIdentityKey();
LogWarn("Obtained lokid identity keys");
break;
}
catch (const std::exception& e)
{
LogWarn(
"Failed attempt ",
numTries,
" of ",
maxTries,
" to get lokid identity keys because: ",
e.what());
if (numTries == maxTries)
throw;
}
}
}
else
{

Loading…
Cancel
Save