mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 01:01:02 +00:00
skip missing sections
This commit is contained in:
parent
10e78785cd
commit
a96482b186
@ -101,15 +101,29 @@ namespace data
|
|||||||
m_LastUpdateTime = boost::posix_time::time_from_string (t);
|
m_LastUpdateTime = boost::posix_time::time_from_string (t);
|
||||||
if ((GetTime () - m_LastUpdateTime).hours () < PEER_PROFILE_EXPIRATION_TIMEOUT)
|
if ((GetTime () - m_LastUpdateTime).hours () < PEER_PROFILE_EXPIRATION_TIMEOUT)
|
||||||
{
|
{
|
||||||
// read participations
|
try
|
||||||
auto participations = pt.get_child (PEER_PROFILE_SECTION_PARTICIPATION);
|
{
|
||||||
m_NumTunnelsAgreed = participations.get (PEER_PROFILE_PARTICIPATION_AGREED, 0);
|
// read participations
|
||||||
m_NumTunnelsDeclined = participations.get (PEER_PROFILE_PARTICIPATION_DECLINED, 0);
|
auto participations = pt.get_child (PEER_PROFILE_SECTION_PARTICIPATION);
|
||||||
m_NumTunnelsNonReplied = participations.get (PEER_PROFILE_PARTICIPATION_NON_REPLIED, 0);
|
m_NumTunnelsAgreed = participations.get (PEER_PROFILE_PARTICIPATION_AGREED, 0);
|
||||||
// read usage
|
m_NumTunnelsDeclined = participations.get (PEER_PROFILE_PARTICIPATION_DECLINED, 0);
|
||||||
auto usage = pt.get_child (PEER_PROFILE_SECTION_USAGE);
|
m_NumTunnelsNonReplied = participations.get (PEER_PROFILE_PARTICIPATION_NON_REPLIED, 0);
|
||||||
m_NumTimesTaken = usage.get (PEER_PROFILE_USAGE_TAKEN, 0);
|
}
|
||||||
m_NumTimesRejected = usage.get (PEER_PROFILE_USAGE_REJECTED, 0);
|
catch (boost::property_tree::ptree_bad_path& ex)
|
||||||
|
{
|
||||||
|
LogPrint (eLogWarning, "Missing section ", PEER_PROFILE_SECTION_PARTICIPATION);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// read usage
|
||||||
|
auto usage = pt.get_child (PEER_PROFILE_SECTION_USAGE);
|
||||||
|
m_NumTimesTaken = usage.get (PEER_PROFILE_USAGE_TAKEN, 0);
|
||||||
|
m_NumTimesRejected = usage.get (PEER_PROFILE_USAGE_REJECTED, 0);
|
||||||
|
}
|
||||||
|
catch (boost::property_tree::ptree_bad_path& ex)
|
||||||
|
{
|
||||||
|
LogPrint (eLogWarning, "Missing section ", PEER_PROFILE_SECTION_USAGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*this = RouterProfile (m_IdentHash);
|
*this = RouterProfile (m_IdentHash);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user