mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 04:15:23 +03:00
Kernel/Net: Don't update TCP socket "last sent ACK" field too early
Defer updating this field until after the last fallible operation has succeeded.
This commit is contained in:
parent
06cf01cd1e
commit
c797eaa9f8
Notes:
sideshowbarker
2024-07-17 19:01:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c797eaa9f8
@ -237,12 +237,6 @@ ErrorOr<void> TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* pa
|
||||
tcp_packet.set_data_offset(tcp_header_size / sizeof(u32));
|
||||
tcp_packet.set_flags(flags);
|
||||
|
||||
if (flags & TCPFlags::ACK) {
|
||||
m_last_ack_number_sent = m_ack_number;
|
||||
m_last_ack_sent_time = kgettimeofday();
|
||||
tcp_packet.set_ack_number(m_ack_number);
|
||||
}
|
||||
|
||||
if (payload) {
|
||||
if (auto result = payload->read(tcp_packet.payload(), payload_size); result.is_error()) {
|
||||
routing_decision.adapter->release_packet_buffer(*packet);
|
||||
@ -250,6 +244,12 @@ ErrorOr<void> TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* pa
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & TCPFlags::ACK) {
|
||||
m_last_ack_number_sent = m_ack_number;
|
||||
m_last_ack_sent_time = kgettimeofday();
|
||||
tcp_packet.set_ack_number(m_ack_number);
|
||||
}
|
||||
|
||||
if (flags & TCPFlags::SYN) {
|
||||
++m_sequence_number;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user