Previously we had to initiate a new RDP connection with a request containing a non-zero length packet. However, for streams this should not be necessary. So moving the conn-queue push to earlier will allow for a service to start transmitting as soon as somebody connects to the port.
Also i have removed the call to srand() since i feel this is something that is best done outside of the RDP stack. Furthermore it resulted in using the same sequence number if two connections were made within the same millisecond
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