1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 19:42:14 +00:00

Kernel: Make File's can_read/can_write take a const FileDescription&

Asking a File if we could possibly read or write it will never mutate
the asking FileDescription&, so it should be const.
This commit is contained in:
Andreas Kling 2019-11-04 14:03:14 +01:00
parent e8fee92357
commit 1b2ef8582c
47 changed files with 97 additions and 91 deletions

View file

@ -574,9 +574,12 @@ void handle_tcp(const IPv4Packet& ipv4_packet)
socket->sequence_number());
#endif
socket->send_tcp_packet(TCPFlags::ACK);
bool should_ack = true;
if (payload_size != 0) {
should_ack = socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()));
}
if (payload_size != 0)
socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()));
if (should_ack)
socket->send_tcp_packet(TCPFlags::ACK);
}
}