mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 22:42:08 +00: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
1 changed files with 5 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue