[En-Nut-Discussion] Thread stops executing after some time.

Henrik Maier hmlists at focus-sw.com
Sun Apr 6 12:52:03 CEST 2008


Harald,

A suggested permanent fix would be to base the decision on re-transmission
solely on the existence of a send buffer which is indicated by
sock->so_tx_nbq.

In net/tcpsm.c NutTcpSm() change:
                if (sock->so_tx_nbq && sock->so_retran_time) {
to:
                if (sock->so_tx_nbq) {

In net/tcputil NutTcpCalcRtt() remove these lines:
    if (sock->so_retran_time == 0)
        return;

In net/NutTcpStateSynReceived remove this line
    	sock->so_retran_time = 0;

In net/NutTcpAbortSocketremove remove this line:
    	sock->so_retran_time = 0;

I haven't tested this yet but think this would be a cleaner solution than
sock->so_retran_time = (u_short) NutGetMillis() | 1.

Regards

Henrik
http://www.proconx.com

> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
> bounces at egnite.de] On Behalf Of Harald Kipp
> Sent: Sunday, 6 April 2008 6:58 PM
> To: Ethernut User Chat (English)
> Subject: Re: [En-Nut-Discussion] Thread stops executing after some time.
> 
> Henrik Maier wrote:
> >
> > Erik, I suggest to change in the Nut/OS file net\tcpout.c (around line
> 336) the statement:
> >             sock->so_retran_time = (u_short) NutGetMillis();
> > to
> >             sock->so_retran_time = (u_short) NutGetMillis();
> >             if (sock->so_retran_time == 0)
> >                sock->so_retran_time = 1; // so_retran_time must not be 0
> which is a magic value!
> 
> Excellent, Henrik.
> 
> Here is what I did:
> 
> Added some extra code in ethin.c, which discards every 7th packet.
> 
> Added some extra code in ipout.c, which creates a bad checksum for each
> 13th packet.
> 
> Masked out the lower 17 bits of the NutGetMillis result at two locations
> in tcpsm.c (near lines 500 and 940) and one location in tcpout.c (near
> line 340). This way so_retran_time becomes zero more likely.
> 
> Created a Nut/OS and Windows application to test transfers in both
> direction. The Nut/OS application continuously prints the current result
> of NutGetMillis.
> 
> Here are the results:
> 
> Without further modification the transfer stopped after some minutes.
> 
> Then I changed all three locations to
> sock->so_retran_time = (u_short) NutGetMillis() | 1;
> 
> After 12 hours the connections are still running. I'll update 4.4 as
> well as CVS HEAD.
> 
> Harald
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list