tcp: reset receive.low_water_mark when nothing to read anymore

the socket interface module checks the receive.low_water_mark to automatically
notify a read event. available_data will be zero, thus enabling the notification.

fixes the test poll_nm in NSPR.

Change-Id: I5354faec439df96671506550cdb144a45f6082b1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4820
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jérôme Duval
2021-12-17 20:40:55 +00:00
committed by waddlesplash
parent 18e885db51
commit 3285dcae22
2 changed files with 5 additions and 2 deletions
@@ -1011,6 +1011,9 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
TRACE(" ReadData(): %" B_PRIuSIZE " bytes kept.",
fReceiveQueue.Available());
if (fReceiveQueue.Available() == 0 && fState == FINISH_RECEIVED)
socket->receive.low_water_mark = 0;
// if we are opening the window, check if we should send an ACK
if (!clone)
SendAcknowledge(false);
@@ -1438,7 +1441,7 @@ TCPEndpoint::_ShouldReceive() const
return false;
return fState == ESTABLISHED || fState == FINISH_SENT
|| fState == FINISH_ACKNOWLEDGED;
|| fState == FINISH_ACKNOWLEDGED || fState == FINISH_RECEIVED;
}
@@ -429,7 +429,7 @@ add_tcp_header(net_address_module_info* addressModule,
optionsLength);
}
TRACE(("add_tcp_header(): buffer %p, flags 0x%x, seq %lu, ack %lu, up %u, "
TRACE(("add_tcp_header(): buffer %p, flags 0x%x, seq %" B_PRIu32 ", ack %" B_PRIu32 ", up %u, "
"win %u\n", buffer, segment.flags, segment.sequence,
segment.acknowledge, segment.urgent_offset, segment.advertised_window));