mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-23 17:36:37 +02:00
publish preferred key first
This commit is contained in:
parent
f6c93f7345
commit
e69b56c4e3
1 changed files with 20 additions and 3 deletions
|
@ -1475,10 +1475,27 @@ namespace client
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// standard LS2 (type 3) first
|
// standard LS2 (type 3) first
|
||||||
|
if (m_EncryptionKeys.empty ())
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Destinations: No encryption keys");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
i2p::data::LocalLeaseSet2::EncryptionKeys keySections;
|
i2p::data::LocalLeaseSet2::EncryptionKeys keySections;
|
||||||
for (const auto& it: m_EncryptionKeys)
|
std::shared_ptr<const i2p::crypto::LocalEncryptionKey> preferredSection;
|
||||||
keySections.push_back (it.second);
|
if (m_EncryptionKeys.size () == 1)
|
||||||
|
preferredSection = m_EncryptionKeys.begin ()->second; // only key
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (const auto& it: m_EncryptionKeys)
|
||||||
|
if (it.first == m_PreferredCryptoType)
|
||||||
|
preferredSection = it.second;
|
||||||
|
else
|
||||||
|
keySections.push_back (it.second);
|
||||||
|
}
|
||||||
|
if (preferredSection)
|
||||||
|
keySections.push_front (preferredSection); // make preferred first
|
||||||
|
|
||||||
auto publishedTimestamp = i2p::util::GetSecondsSinceEpoch ();
|
auto publishedTimestamp = i2p::util::GetSecondsSinceEpoch ();
|
||||||
if (publishedTimestamp <= m_LastPublishedTimestamp)
|
if (publishedTimestamp <= m_LastPublishedTimestamp)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue