1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 14:07:42 +00:00

Kernel: Use timeval_sub for TCP retransmissions and lower timer to 500ms

This commit is contained in:
Conrad Pankoff 2019-09-08 19:40:26 +10:00 committed by Andreas Kling
parent 3f1c3a341b
commit c983e96664

View file

@ -1,3 +1,4 @@
#include <AK/Time.h>
#include <Kernel/Devices/RandomDevice.h> #include <Kernel/Devices/RandomDevice.h>
#include <Kernel/FileSystem/FileDescription.h> #include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Net/NetworkAdapter.h> #include <Kernel/Net/NetworkAdapter.h>
@ -184,7 +185,9 @@ void TCPSocket::send_outgoing_packets()
auto now = kgettimeofday(); auto now = kgettimeofday();
for (auto& packet : m_not_acked) { for (auto& packet : m_not_acked) {
if (now.tv_sec <= packet.tx_time.tv_sec) timeval diff;
timeval_sub(packet.tx_time, now, diff);
if (diff.tv_sec < 1 && diff.tv_usec <= 500000)
continue; continue;
packet.tx_time = now; packet.tx_time = now;