1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 05:35:07 +00:00

TCP: Collect the payload if present in a packet with FIN set.

This commit is contained in:
Andreas Kling 2019-03-14 15:28:23 +01:00
parent 25e521f510
commit f9569db1e5
3 changed files with 9 additions and 1 deletions

View file

@ -222,9 +222,11 @@ ssize_t IPv4Socket::recvfrom(void* buffer, size_t buffer_length, int flags, sock
void IPv4Socket::did_receive(ByteBuffer&& packet)
{
LOCKER(lock());
auto packet_size = packet.size();
m_receive_queue.append(move(packet));
m_can_read = true;
m_bytes_received += packet_size;
#ifdef IPV4_SOCKET_DEBUG
kprintf("IPv4Socket(%p): did_receive %d bytes, packets in queue: %d\n", this, packet.size(), m_receive_queue.size_slow());
kprintf("IPv4Socket(%p): did_receive %d bytes, total_received=%u, packets in queue: %d\n", this, packet_size, m_bytes_received, m_receive_queue.size_slow());
#endif
}