Skip to content

Commit

Permalink
bugfix: RDP do not close connection in CLOSE_WAIT
Browse files Browse the repository at this point in the history
When the first RST is receive the rdp state is set to CLOSE_WAIT, and
the userspace is requested to close the connection by posting a null
pointer to the RX queue.

On the second RST message received, the connection is forcefully closed.
If the userspace task was still working on the RX queue, it will
therefore be denied the remainder of the received data.

This fix means that a connection that was already closed by the
userspace (on the first node to call csp_close()) and therefore put into
CLOSE_WAIT, will remain in CLOSE_WAIT untill the rdp timeout happens and
sliently sets the state to CLOSED.

This resolution is more in line with the original RDP specification
where connections were always left to just timeout in the CLOSE_WAIT
state.
  • Loading branch information
Johan De Claville Christiansen committed Feb 7, 2017
1 parent 4f24bd0 commit ece8361
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/transport/csp_rdp.c
Expand Up @@ -588,9 +588,7 @@ void csp_rdp_new_packet(csp_conn_t * conn, csp_packet_t * packet) {

if (conn->rdp.state == RDP_CLOSE_WAIT || conn->rdp.state == RDP_CLOSED) {
csp_log_protocol("RST received in CLOSE_WAIT or CLOSED. Now closing connection");
csp_buffer_free(packet);
csp_close(conn);
return;
goto discard_close;
} else {
csp_log_protocol("Got RESET in state %u", conn->rdp.state);

Expand Down

0 comments on commit ece8361

Please sign in to comment.