mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:04:57 +00:00
Kernel: Properly report receive window size in sent TCP packets
Instead of lying and claiming we always have space left in our receive buffer, actually report the available space. While this doesn't really affect network-bound workloads, it makes a world of difference in cpu/disk-bound ones, like git clones. Resulting in a considerable speed-up, and in some cases making them work at all. (instead of the sender side hanging up the connection due to timeouts)
This commit is contained in:
parent
69f88c9a64
commit
2c51ff763b
2 changed files with 3 additions and 1 deletions
|
@ -260,7 +260,7 @@ ErrorOr<void> TCPSocket::send_tcp_packet(u16 flags, UserOrKernelBuffer const* pa
|
|||
VERIFY(local_port());
|
||||
tcp_packet.set_source_port(local_port());
|
||||
tcp_packet.set_destination_port(peer_port());
|
||||
tcp_packet.set_window_size(NumericLimits<u16>::max());
|
||||
tcp_packet.set_window_size(min(available_space_in_receive_buffer(), NumericLimits<u16>::max()));
|
||||
tcp_packet.set_sequence_number(m_sequence_number);
|
||||
tcp_packet.set_data_offset(tcp_header_size / sizeof(u32));
|
||||
tcp_packet.set_flags(flags);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue