[En-Nut-Discussion] NutTcpStateActiveOpenEvent fails for "tiny" connections

Malte Marwedel m.marwedel at onlinehome.de
Wed Jan 27 01:06:43 CET 2010


Hello,
some time ago, I reported, that the ftp server did not work with small 
files:
http://lists.egnite.de/pipermail/en-nut-discussion/2009-November/011418.html
I traced down what the problem is, and found that  in
NutTcpStateActiveOpenEvent(TCPSOCKET * sock)

if(sock->so_state == TCPS_SYN_SENT)
   NutEventWait(&sock->so_ac_tq, 0);
if (sock->so_state != TCPS_ESTABLISHED)
   return -1;

Returns -1 because the so_state is already TCPS_CLOSE_WAIT.
I can see with Wireshark, that the data bytes are properly transmitted 
and the host sent already a FIN.

Is there any simple solution for the problem? I don't know not enough 
about the TCP state machine to predict if some unwanted side effects 
could happen if I replace it with
if ((sock->so_state != TCPS_ESTABLISHED) && (sock->so_state != 
TCPS_CLOSE_WAIT))

Malte



More information about the En-Nut-Discussion mailing list