mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-23 17:36:37 +02:00
recreate router.info if missing or malformed
This commit is contained in:
parent
97afa502c5
commit
f48a7df80f
2 changed files with 18 additions and 8 deletions
|
@ -356,16 +356,24 @@ namespace i2p
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
i2p::data::RouterInfo routerInfo(i2p::fs::DataDirPath (ROUTER_INFO)); // TODO
|
|
||||||
m_RouterInfo.SetRouterIdentity (GetIdentity ());
|
m_RouterInfo.SetRouterIdentity (GetIdentity ());
|
||||||
m_RouterInfo.Update (routerInfo.GetBuffer (), routerInfo.GetBufferLen ());
|
i2p::data::RouterInfo routerInfo(i2p::fs::DataDirPath (ROUTER_INFO));
|
||||||
m_RouterInfo.SetProperty ("coreVersion", I2P_VERSION);
|
if (!routerInfo.IsUnreachable ()) // router.info looks good
|
||||||
m_RouterInfo.SetProperty ("router.version", I2P_VERSION);
|
{
|
||||||
|
m_RouterInfo.Update (routerInfo.GetBuffer (), routerInfo.GetBufferLen ());
|
||||||
|
m_RouterInfo.SetProperty ("coreVersion", I2P_VERSION);
|
||||||
|
m_RouterInfo.SetProperty ("router.version", I2P_VERSION);
|
||||||
|
|
||||||
|
// Migration to 0.9.24. TODO: remove later
|
||||||
|
m_RouterInfo.DeleteProperty ("coreVersion");
|
||||||
|
m_RouterInfo.DeleteProperty ("stat_uptime");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, ROUTER_INFO, " is malformed. Creating new");
|
||||||
|
NewRouterInfo ();
|
||||||
|
}
|
||||||
|
|
||||||
// Migration to 0.9.24. TODO: remove later
|
|
||||||
m_RouterInfo.DeleteProperty ("coreVersion");
|
|
||||||
m_RouterInfo.DeleteProperty ("stat_uptime");
|
|
||||||
|
|
||||||
if (IsUnreachable ())
|
if (IsUnreachable ())
|
||||||
SetReachable (); // we assume reachable until we discover firewall through peer tests
|
SetReachable (); // we assume reachable until we discover firewall through peer tests
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,8 @@ namespace data
|
||||||
{
|
{
|
||||||
if (LoadFile ())
|
if (LoadFile ())
|
||||||
ReadFromBuffer (false);
|
ReadFromBuffer (false);
|
||||||
|
else
|
||||||
|
m_IsUnreachable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouterInfo::ReadFromBuffer (bool verifySignature)
|
void RouterInfo::ReadFromBuffer (bool verifySignature)
|
||||||
|
|
Loading…
Add table
Reference in a new issue