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
continue; continue;
} }
numAddresses++; numAddresses++;
if (m_Addresses.count(name) > 0) auto it = m_Addresses.find (name);
continue; /* already exists */ if (it != m_Addresses.end ()) // aleady exists ?
m_Addresses[name] = ident->GetIdentHash (); {
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); m_Storage->AddAddress (ident);
if (is_update) if (is_update)
LogPrint(eLogInfo, "Addressbook: added new host: ", name); LogPrint (eLogInfo, "Addressbook: added new host: ", name);
}
} }
else else
incomplete = f.eof (); incomplete = f.eof ();

Loading…
Cancel
Save