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

Harald Kipp harald.kipp at egnite.de
Sun Apr 6 10:57:52 CEST 2008


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



More information about the En-Nut-Discussion mailing list