mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
rollback
This commit is contained in:
parent
0eb8e15796
commit
ae5cb3bbe7
@ -35,10 +35,12 @@ namespace data
|
||||
}
|
||||
|
||||
RouterInfo::RouterInfo (const std::string& fullPath):
|
||||
m_Buffer (nullptr), m_IsUpdated (false), m_IsUnreachable (false),
|
||||
m_SupportedTransports (0),m_ReachableTransports (0), m_Caps (0), m_Version (0)
|
||||
m_IsUpdated (false), m_IsUnreachable (false),
|
||||
m_SupportedTransports (0),m_ReachableTransports (0),
|
||||
m_Caps (0), m_Version (0)
|
||||
{
|
||||
m_Addresses = boost::make_shared<Addresses>(); // create empty list
|
||||
m_Buffer = new uint8_t[MAX_RI_BUFFER_SIZE];
|
||||
ReadFromFile (fullPath);
|
||||
}
|
||||
|
||||
@ -49,7 +51,7 @@ namespace data
|
||||
m_Addresses = boost::make_shared<Addresses>(); // create empty list
|
||||
if (len <= MAX_RI_BUFFER_SIZE)
|
||||
{
|
||||
m_Buffer = new uint8_t[len];
|
||||
m_Buffer = new uint8_t[MAX_RI_BUFFER_SIZE];
|
||||
memcpy (m_Buffer, buf, len);
|
||||
m_BufferLen = len;
|
||||
ReadFromBuffer (true);
|
||||
@ -88,13 +90,8 @@ namespace data
|
||||
// don't clean up m_Addresses, it will be replaced in ReadFromStream
|
||||
m_Properties.clear ();
|
||||
// copy buffer
|
||||
if (m_Buffer && m_BufferLen < len)
|
||||
{
|
||||
delete[] m_Buffer;
|
||||
m_Buffer = nullptr;
|
||||
}
|
||||
if (!m_Buffer)
|
||||
m_Buffer = new uint8_t[len];
|
||||
m_Buffer = new uint8_t[MAX_RI_BUFFER_SIZE];
|
||||
memcpy (m_Buffer, buf, len);
|
||||
m_BufferLen = len;
|
||||
// skip identity
|
||||
@ -130,8 +127,8 @@ namespace data
|
||||
return false;
|
||||
}
|
||||
s.seekg(0, std::ios::beg);
|
||||
if (m_Buffer) delete[] m_Buffer;
|
||||
m_Buffer = new uint8_t[m_BufferLen];
|
||||
if (!m_Buffer)
|
||||
m_Buffer = new uint8_t[MAX_RI_BUFFER_SIZE];
|
||||
s.read((char *)m_Buffer, m_BufferLen);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user