|
|
|
@ -2,6 +2,7 @@
@@ -2,6 +2,7 @@
|
|
|
|
|
#include <boost/bind.hpp> |
|
|
|
|
#include "Log.h" |
|
|
|
|
#include "Timestamp.h" |
|
|
|
|
#include "NetDb.h" |
|
|
|
|
#include "SSU.h" |
|
|
|
|
#include "SSUData.h" |
|
|
|
|
|
|
|
|
@ -15,8 +16,24 @@ namespace ssu
@@ -15,8 +16,24 @@ namespace ssu
|
|
|
|
|
m_PacketSize = SSU_MAX_PACKET_SIZE; |
|
|
|
|
auto remoteRouter = session.GetRemoteRouter (); |
|
|
|
|
if (remoteRouter) |
|
|
|
|
AdjustPacketSize (*remoteRouter); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SSUData::~SSUData () |
|
|
|
|
{ |
|
|
|
|
for (auto it: m_IncomleteMessages) |
|
|
|
|
if (it.second) |
|
|
|
|
{ |
|
|
|
|
DeleteI2NPMessage (it.second->msg); |
|
|
|
|
delete it.second; |
|
|
|
|
} |
|
|
|
|
for (auto it: m_SentMessages) |
|
|
|
|
delete it.second; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SSUData::AdjustPacketSize (const i2p::data::RouterInfo& remoteRouter) |
|
|
|
|
{ |
|
|
|
|
auto ssuAddress = remoteRouter->GetSSUAddress (); |
|
|
|
|
auto ssuAddress = remoteRouter.GetSSUAddress (); |
|
|
|
|
if (ssuAddress && ssuAddress->mtu) |
|
|
|
|
{ |
|
|
|
|
m_PacketSize = ssuAddress->mtu - IPV4_HEADER_SIZE - UDP_HEADER_SIZE; |
|
|
|
@ -35,18 +52,12 @@ namespace ssu
@@ -35,18 +52,12 @@ namespace ssu
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SSUData::~SSUData () |
|
|
|
|
{ |
|
|
|
|
for (auto it: m_IncomleteMessages) |
|
|
|
|
if (it.second) |
|
|
|
|
void SSUData::UpdatePacketSize (const i2p::data::IdentHash& remoteIdent) |
|
|
|
|
{ |
|
|
|
|
DeleteI2NPMessage (it.second->msg); |
|
|
|
|
delete it.second; |
|
|
|
|
} |
|
|
|
|
for (auto it: m_SentMessages) |
|
|
|
|
delete it.second; |
|
|
|
|
auto routerInfo = i2p::data::netdb.FindRouter (remoteIdent); |
|
|
|
|
if (routerInfo) |
|
|
|
|
AdjustPacketSize (*routerInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SSUData::ProcessSentMessageAck (uint32_t msgID) |
|
|
|
|