Browse Source

overwrite existing address

pull/908/head
orignal 7 years ago
parent
commit
d7b412c1eb
  1. 19
      libi2pd_client/AddressBook.cpp

19
libi2pd_client/AddressBook.cpp

@ -376,12 +376,23 @@ namespace client @@ -376,12 +376,23 @@ namespace client
continue;
}
numAddresses++;
if (m_Addresses.count(name) > 0)
continue; /* already exists */
m_Addresses[name] = ident->GetIdentHash ();
auto it = m_Addresses.find (name);
if (it != m_Addresses.end ()) // aleady exists ?
{
if (it->second != ident->GetIdentHash ()) // address changed?
{
it->second = ident->GetIdentHash ();
m_Storage->AddAddress (ident);
LogPrint (eLogInfo, "Addressbook: updated host: ", name);
}
}
else
{
m_Addresses.insert (std::make_pair (name, ident->GetIdentHash ()));
m_Storage->AddAddress (ident);
if (is_update)
LogPrint(eLogInfo, "Addressbook: added new host: ", name);
LogPrint (eLogInfo, "Addressbook: added new host: ", name);
}
}
else
incomplete = f.eof ();

Loading…
Cancel
Save