mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Kernel: Release packet buffer in TCPSocket::send_tcp_packet
Previously we wouldn't release the buffer back to the network adapter in all cases. While this didn't leak the buffer it would cause the buffer to not be reused for other packets.
This commit is contained in:
parent
547eb4973a
commit
3fc75088a2
Notes:
sideshowbarker
2024-07-18 17:17:03 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/3fc75088a21 Pull-request: https://github.com/SerenityOS/serenity/pull/7513
@ -220,8 +220,10 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload,
|
||||
tcp_packet.set_ack_number(m_ack_number);
|
||||
}
|
||||
|
||||
if (payload && !payload->read(tcp_packet.payload(), payload_size))
|
||||
if (payload && !payload->read(tcp_packet.payload(), payload_size)) {
|
||||
routing_decision.adapter->release_packet_buffer(*packet);
|
||||
return EFAULT;
|
||||
}
|
||||
|
||||
if (flags & TCPFlags::SYN) {
|
||||
++m_sequence_number;
|
||||
@ -247,6 +249,8 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload,
|
||||
m_not_acked.append({ m_sequence_number, move(packet), ipv4_payload_offset, *routing_decision.adapter });
|
||||
m_not_acked_size += payload_size;
|
||||
enqueue_for_retransmit();
|
||||
} else {
|
||||
routing_decision.adapter->release_packet_buffer(*packet);
|
||||
}
|
||||
|
||||
return KSuccess;
|
||||
|
Loading…
Reference in New Issue
Block a user