mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
IPv4: Send TCP packets right away instead of waiting to "retry"
Also be more explicit about zero-initializing OutgoingPacket objects.
This commit is contained in:
parent
a7e72f78cd
commit
6be880bd10
Notes:
sideshowbarker
2024-07-19 09:32:18 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6be880bd10d
@ -190,7 +190,7 @@ void TCPSocket::send_tcp_packet(u16 flags, const void* payload, size_t payload_s
|
|||||||
|
|
||||||
if (tcp_packet.has_syn() || payload_size > 0) {
|
if (tcp_packet.has_syn() || payload_size > 0) {
|
||||||
LOCKER(m_not_acked_lock);
|
LOCKER(m_not_acked_lock);
|
||||||
m_not_acked.append({ m_sequence_number, move(buffer), 0, {} });
|
m_not_acked.append({ m_sequence_number, move(buffer) });
|
||||||
send_outgoing_packets();
|
send_outgoing_packets();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -217,9 +217,8 @@ void TCPSocket::send_outgoing_packets()
|
|||||||
for (auto& packet : m_not_acked) {
|
for (auto& packet : m_not_acked) {
|
||||||
timeval diff;
|
timeval diff;
|
||||||
timeval_sub(packet.tx_time, now, diff);
|
timeval_sub(packet.tx_time, now, diff);
|
||||||
if (diff.tv_sec < 1 && diff.tv_usec <= 500000)
|
if (diff.tv_sec == 0 && diff.tv_usec <= 500000)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
packet.tx_time = now;
|
packet.tx_time = now;
|
||||||
packet.tx_counter++;
|
packet.tx_counter++;
|
||||||
|
|
||||||
|
@ -192,10 +192,10 @@ private:
|
|||||||
u32 m_bytes_out { 0 };
|
u32 m_bytes_out { 0 };
|
||||||
|
|
||||||
struct OutgoingPacket {
|
struct OutgoingPacket {
|
||||||
u32 ack_number;
|
u32 ack_number { 0 };
|
||||||
ByteBuffer buffer;
|
ByteBuffer buffer;
|
||||||
int tx_counter { 0 };
|
int tx_counter { 0 };
|
||||||
timeval tx_time;
|
timeval tx_time { 0, 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
Lock m_not_acked_lock { "TCPSocket unacked packets" };
|
Lock m_not_acked_lock { "TCPSocket unacked packets" };
|
||||||
|
Loading…
Reference in New Issue
Block a user