Commit 0cd0729d authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

pseudotcp: Fix EOS return from recv() in non-FIN–ACK mode

Change pseudo_tcp_socket_recv() to return 0 if in non-FIN–ACK mode and
the socket has been shut down. This makes the behaviour of FIN–ACK and
non-FIN–ACK modes consistent.

This is a behaviour change from before the introduction of FIN–ACK mode
— previously, pseudo_tcp_socket_recv() would return -1 and set the
ENOTCONN error if called after the socket had been shut down (i.e. after
pseudo_tcp_socket_get_next_clock() had returned FALSE). The new
behaviour will hopefully not break anything.
parent f75a8a43
......@@ -1155,6 +1155,11 @@ pseudo_tcp_socket_recv(PseudoTcpSocket *self, char * buffer, size_t len)
return 0;
/* Return 0 if FIN-ACK is not supported but the socket has been closed. */
if (!priv->support_fin_ack && pseudo_tcp_socket_is_closed (self)) {
return 0;
/* Return ENOTCONN if FIN-ACK is not supported and the connection is not
if (!priv->support_fin_ack && priv->state != TCP_ESTABLISHED) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment