[En-Nut-Discussion] TCP sockets stuck in closing state

Stefan Hax stefan at escherlogic.com
Tue May 5 15:59:19 CEST 2015


Hi,

This is what I did to fix this issue in 'tcpsm.c':

int NutTcpStateActiveOpenEvent(TCPSOCKET * sock)
{
     /*
      * Switch state to SYN_SENT. This will
      * transmit a SYN packet.
      */
     NutTcpStateChange(sock, TCPS_SYN_SENT);

     /*
      * Block application.
      */
     if(sock->so_state == TCPS_SYN_SENT) {
         //NutEventWait(&sock->so_ac_tq, 0);
         if( NutEventWait(&sock->so_ac_tq, sock->so_write_to) ) {        
// added the write T.O. to the blocking ... so we are not stuck here 
forever!!
             return -1;
         }
     }


     if (sock->so_state != TCPS_ESTABLISHED && sock->so_state != 
TCPS_CLOSE_WAIT)
         return -1;

     return 0;
}

Hope this helps,

Stefan Hax.



On 2015-05-05 9:40 AM, Uwe Bonnes wrote:
>>>>>> "Coleman" == Coleman Brumley <cbrumley at polarsoft.biz> writes:
>      Coleman> Sorry, that should have said "is there no timeout for the ACK
>      Coleman> in the CLOSING state".
>
> Hello,
>
> I can feel your pain, but I am no TCP expert. Hopefully somebody
> knowledgeable will drop into this discussion...
>
> Bye



More information about the En-Nut-Discussion mailing list