mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-28 03:04:30 +00:00
moved last repliable datagram time to UDPConnection
This commit is contained in:
@@ -55,7 +55,7 @@ namespace client
|
||||
replyOptions.Put (UDP_SESSION_ACKED, m_LastSession->m_LastReceivedPacketNum);
|
||||
m_LastSession->m_Destination->SendDatagram(m_LastSession->GetDatagramSession (),
|
||||
nullptr, 0, m_LastSession->LocalPort, m_LastSession->RemotePort, &replyOptions); // Ack only, no payload
|
||||
m_LastSession->LastRepliableDatagramTime = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
m_LastSession->m_LastRepliableDatagramTime = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
}
|
||||
}
|
||||
if (options->Get (UDP_SESSION_ACKED, seqn))
|
||||
@@ -248,7 +248,7 @@ namespace client
|
||||
UDPConnection (localDestination->GetService(), localDestination->GetDatagramDestination()),
|
||||
IPSocket(localDestination->GetService(), localEndpoint),
|
||||
SendEndpoint(endpoint), LastActivity(i2p::util::GetMillisecondsSinceEpoch()),
|
||||
LastRepliableDatagramTime (0), LocalPort(ourPort), RemotePort(theirPort)
|
||||
LocalPort(ourPort), RemotePort(theirPort)
|
||||
{
|
||||
SetIdentity (to);
|
||||
Start ();
|
||||
@@ -279,7 +279,7 @@ namespace client
|
||||
auto session = GetDatagramSession ();
|
||||
uint64_t repliableDatagramInterval = I2P_UDP_REPLIABLE_DATAGRAM_INTERVAL;
|
||||
if (m_RTT && m_RTT >= I2P_UDP_REPLIABLE_DATAGRAM_INTERVAL && m_RTT < I2P_UDP_REPLIABLE_DATAGRAM_INTERVAL*10) repliableDatagramInterval = m_RTT/10; // 10 - 100 ms
|
||||
if (ts > LastRepliableDatagramTime + repliableDatagramInterval)
|
||||
if (ts > m_LastRepliableDatagramTime + repliableDatagramInterval)
|
||||
{
|
||||
if (session->GetVersion () == i2p::datagram::eDatagramV3)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ namespace client
|
||||
}
|
||||
else
|
||||
m_Destination->SendDatagram(session, m_Buffer, len, LocalPort, RemotePort);
|
||||
LastRepliableDatagramTime = ts;
|
||||
m_LastRepliableDatagramTime = ts;
|
||||
}
|
||||
else
|
||||
m_Destination->SendRawDatagram(session, m_Buffer, len, LocalPort, RemotePort);
|
||||
@@ -397,8 +397,7 @@ namespace client
|
||||
UDPConnection (localDestination->GetService (), localDestination->GetDatagramDestination ()),
|
||||
m_Name (name), m_RemoteDest (remoteDest), m_LocalDest (localDestination), m_LocalEndpoint (localEndpoint),
|
||||
m_ResolveThread (nullptr), m_LocalSocket (nullptr), RemotePort (remotePort),
|
||||
m_LastPort (0), m_cancel_resolve (false), m_Gzip (gzip), m_DatagramVersion (datagramVersion),
|
||||
m_LastRepliableDatagramTime (0)
|
||||
m_LastPort (0), m_cancel_resolve (false), m_Gzip (gzip), m_DatagramVersion (datagramVersion)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -616,7 +615,7 @@ namespace client
|
||||
{
|
||||
i2p::util::Mapping replyOptions;
|
||||
replyOptions.Put (UDP_SESSION_ACKED, m_LastReceivedPacketNum);
|
||||
m_LocalDest->GetDatagramDestination ()->SendDatagram (GetDatagramSession (),
|
||||
m_Destination->SendDatagram (GetDatagramSession (),
|
||||
nullptr, 0, m_LastPort, RemotePort, &replyOptions); // Ack only, no payload
|
||||
m_LastRepliableDatagramTime = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace client
|
||||
{
|
||||
i2p::datagram::DatagramDestination * m_Destination;
|
||||
std::weak_ptr<i2p::datagram::DatagramSession> m_LastDatagramSession;
|
||||
uint64_t m_LastRepliableDatagramTime; // millseconds
|
||||
i2p::data::IdentHash Identity;
|
||||
bool isIdentity = false;
|
||||
uint32_t m_NextSendPacketNum = 1, m_LastReceivedPacketNum = 0;
|
||||
@@ -52,7 +53,7 @@ namespace client
|
||||
bool m_IsFirstPacket = true;
|
||||
|
||||
UDPConnection (boost::asio::io_context& service, i2p::datagram::DatagramDestination * destination):
|
||||
m_Destination (destination), m_AckTimer (service) {};
|
||||
m_Destination (destination), m_LastRepliableDatagramTime (0), m_AckTimer (service) {};
|
||||
void SetIdentity (const i2p::data::IdentHash& ident) { Identity = ident; isIdentity = true; };
|
||||
|
||||
virtual ~UDPConnection () { Stop (); };
|
||||
@@ -71,7 +72,7 @@ namespace client
|
||||
boost::asio::ip::udp::socket IPSocket;
|
||||
boost::asio::ip::udp::endpoint FromEndpoint;
|
||||
boost::asio::ip::udp::endpoint SendEndpoint;
|
||||
uint64_t LastActivity, LastRepliableDatagramTime; // milliseconds
|
||||
uint64_t LastActivity; // milliseconds
|
||||
|
||||
uint16_t LocalPort;
|
||||
uint16_t RemotePort;
|
||||
@@ -210,7 +211,6 @@ namespace client
|
||||
bool m_Gzip;
|
||||
i2p::datagram::DatagramVersion m_DatagramVersion;
|
||||
std::shared_ptr<UDPConvo> m_LastSession;
|
||||
uint64_t m_LastRepliableDatagramTime; // millseconds
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user