Browse Source

reserve address for 3 introducers

pull/1696/head
orignal 3 years ago
parent
commit
44e01b41f8
  1. 7
      libi2pd/RouterInfo.cpp

7
libi2pd/RouterInfo.cpp

@ -187,13 +187,14 @@ namespace data @@ -187,13 +187,14 @@ namespace data
void RouterInfo::ReadFromStream (std::istream& s)
{
if (!s) return;
m_Caps = 0;
s.read ((char *)&m_Timestamp, sizeof (m_Timestamp));
m_Timestamp = be64toh (m_Timestamp);
// read addresses
auto addresses = boost::make_shared<Addresses>();
uint8_t numAddresses;
s.read ((char *)&numAddresses, sizeof (numAddresses)); if (!s) return;
s.read ((char *)&numAddresses, sizeof (numAddresses));
addresses->reserve (numAddresses);
for (int i = 0; i < numAddresses; i++)
{
@ -282,7 +283,11 @@ namespace data @@ -282,7 +283,11 @@ namespace data
if (s) continue; else return;
}
if (index >= address->ssu->introducers.size ())
{
if (address->ssu->introducers.empty ()) // first time
address->ssu->introducers.reserve (3);
address->ssu->introducers.resize (index + 1);
}
Introducer& introducer = address->ssu->introducers.at (index);
if (!strcmp (key, "ihost"))
{

Loading…
Cancel
Save