1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 04:04:16 +00:00

overwrite existing address

This commit is contained in:
orignal 2017-07-18 15:58:32 -04:00
parent e5751334d6
commit d7b412c1eb

View File

@ -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 (); {
m_Storage->AddAddress (ident); if (it->second != ident->GetIdentHash ()) // address changed?
if (is_update) {
LogPrint(eLogInfo, "Addressbook: added new host: ", name); 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);
}
} }
else else
incomplete = f.eof (); incomplete = f.eof ();