mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
Kernel: Send ACK/FIN in response to FIN packets on active connections
This is to work around our lack of a shutdown() implementation.
This commit is contained in:
parent
117d8db2a2
commit
328d52b323
Notes:
sideshowbarker
2024-07-19 12:11:55 +09:00
Author: https://github.com/deoxxa
Commit: 328d52b323
Pull-request: https://github.com/SerenityOS/serenity/pull/530
Reviewed-by: https://github.com/awesomekling
1 changed files with 6 additions and 2 deletions
|
@ -527,8 +527,12 @@ void handle_tcp(const IPv4Packet& ipv4_packet)
|
|||
socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()));
|
||||
|
||||
socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
|
||||
socket->send_tcp_packet(TCPFlags::ACK);
|
||||
socket->set_state(TCPSocket::State::CloseWait);
|
||||
// TODO: We should only send a FIN packet out once we're shutting
|
||||
// down our side of the socket, so we should change this back to
|
||||
// just being an ACK and a transition to CloseWait once we have a
|
||||
// shutdown() implementation.
|
||||
socket->send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
|
||||
socket->set_state(TCPSocket::State::Closing);
|
||||
socket->set_connected(false);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue