mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-22 07:11:47 +02:00
set MTU if local address is specified explicitly. update MTU for ipv6 if not set
This commit is contained in:
parent
09aa96e486
commit
dbb9295063
3 changed files with 72 additions and 18 deletions
libi2pd
|
@ -115,9 +115,22 @@ namespace transport
|
|||
{
|
||||
if (localAddress.is_unspecified ()) return;
|
||||
if (localAddress.is_v4 ())
|
||||
{
|
||||
m_AddressV4 = localAddress;
|
||||
int mtu = i2p::util::net::GetMTU (localAddress);
|
||||
if (mtu < (int)SSU2_MIN_PACKET_SIZE) mtu = SSU2_MIN_PACKET_SIZE;
|
||||
if (mtu > (int)SSU2_MAX_PACKET_SIZE) mtu = SSU2_MAX_PACKET_SIZE;
|
||||
i2p::context.SetMTU (mtu, true);
|
||||
}
|
||||
else if (localAddress.is_v6 ())
|
||||
{
|
||||
m_AddressV6 = localAddress;
|
||||
int maxMTU = i2p::util::net::GetMaxMTU (localAddress.to_v6 ());
|
||||
int mtu = i2p::util::net::GetMTU (localAddress);
|
||||
if (mtu > maxMTU) mtu = maxMTU;
|
||||
if (mtu < (int)SSU2_MIN_PACKET_SIZE) mtu = SSU2_MIN_PACKET_SIZE;
|
||||
i2p::context.SetMTU (mtu, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool SSU2Server::IsSupported (const boost::asio::ip::address& addr) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue