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

Coleman Brumley cbrumley at polarsoft.biz
Wed May 6 15:27:28 CEST 2015


Is there no timeout in the CLOSING state that will force it to TIME_WAIT if
no ACK is received?

That seems to be the issue for me, at least. 

Coleman

> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
> bounces at egnite.de] On Behalf Of Henrik Maier
> Sent: Tuesday, May 05, 2015 8:01 PM
> To: Ethernut User Chat (English)
> Subject: Re: [En-Nut-Discussion] TCP sockets stuck in closing state
> 
> Hi,
> 
> I also added a similar fix, my code below.
> It's the same code like the previous post plus the added tiny connection
fix,
> refer to http://lists.egnite.de/pipermail/en-nut-discussion/2010-
> January/011657.html
> 
> 
> 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)
> //HM+: Apply read t/o also to connect
> #if !defined(ENABLE_CONNECT_TIMEOUT)
> 		NutEventWait(&sock->so_ac_tq, 0);
> #else
> 	 {
> 	    if (NutEventWait(&sock->so_ac_tq, sock->so_read_to))
>              return -1;
> 	 }
> #endif
> //HM-
> 
> //HM+: Tiny connection fix
> //    if (sock->so_state != TCPS_ESTABLISHED)
>      if ((sock->so_state != TCPS_ESTABLISHED) && (sock->so_state !=
> TCPS_CLOSE_WAIT))
> //HM-
>          return -1;
> 
>      return 0;
> }
> 
> 
> Cheers
> 
> Henrik
> 
> 
> On 5/05/2015 11:59 PM, Stefan Hax wrote:
> > 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
> >
> > _______________________________________________
> > http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> >
> 
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion



More information about the En-Nut-Discussion mailing list