mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
* Addressbook: load addresses at start, not on first request
This commit is contained in:
parent
2f2b12811f
commit
576801cd32
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user