|
|
@ -196,6 +196,7 @@ namespace client |
|
|
|
|
|
|
|
|
|
|
|
void AddressBook::Start () |
|
|
|
void AddressBook::Start () |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
LoadHosts (); /* try storage, then hosts.txt, then download */ |
|
|
|
StartSubscriptions (); |
|
|
|
StartSubscriptions (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -276,14 +277,9 @@ namespace client |
|
|
|
|
|
|
|
|
|
|
|
const i2p::data::IdentHash * AddressBook::FindAddress (const std::string& address) |
|
|
|
const i2p::data::IdentHash * AddressBook::FindAddress (const std::string& address) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_IsLoaded) |
|
|
|
auto it = m_Addresses.find (address); |
|
|
|
LoadHosts (); |
|
|
|
if (it != m_Addresses.end ()) |
|
|
|
if (m_IsLoaded) |
|
|
|
return &it->second; |
|
|
|
{ |
|
|
|
|
|
|
|
auto it = m_Addresses.find (address); |
|
|
|
|
|
|
|
if (it != m_Addresses.end ()) |
|
|
|
|
|
|
|
return &it->second; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nullptr; |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -457,8 +453,6 @@ namespace client |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_IsLoaded) |
|
|
|
|
|
|
|
LoadHosts (); |
|
|
|
|
|
|
|
// try it again later
|
|
|
|
// try it again later
|
|
|
|
m_SubscriptionsUpdateTimer->expires_from_now (boost::posix_time::minutes(INITIAL_SUBSCRIPTION_RETRY_TIMEOUT)); |
|
|
|
m_SubscriptionsUpdateTimer->expires_from_now (boost::posix_time::minutes(INITIAL_SUBSCRIPTION_RETRY_TIMEOUT)); |
|
|
|
m_SubscriptionsUpdateTimer->async_wait (std::bind (&AddressBook::HandleSubscriptionsUpdateTimer, |
|
|
|
m_SubscriptionsUpdateTimer->async_wait (std::bind (&AddressBook::HandleSubscriptionsUpdateTimer, |
|
|
|