mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 11:28:27 +01:00
* Addressbook: load addresses at start, not on first request
This commit is contained in:
parent
2f2b12811f
commit
576801cd32
1 changed files with 4 additions and 10 deletions
|
@ -196,6 +196,7 @@ namespace client
|
||||||
|
|
||||||
void AddressBook::Start ()
|
void AddressBook::Start ()
|
||||||
{
|
{
|
||||||
|
LoadHosts (); /* try storage, then hosts.txt, then download */
|
||||||
StartSubscriptions ();
|
StartSubscriptions ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,15 +276,10 @@ 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)
|
|
||||||
LoadHosts ();
|
|
||||||
if (m_IsLoaded)
|
|
||||||
{
|
{
|
||||||
auto it = m_Addresses.find (address);
|
auto it = m_Addresses.find (address);
|
||||||
if (it != m_Addresses.end ())
|
if (it != m_Addresses.end ())
|
||||||
return &it->second;
|
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…
Add table
Reference in a new issue