[En-Nut-Discussion] Latest fix in tcpsm.c and tcpout.c

Alain M. alainm at pobox.com
Thu Apr 10 20:40:01 CEST 2008


May I guggest somining like:

if ( ! ++count ) count = MAXUINT; // if unsigned

if ( (++count) < 0 ) count=MAXINT; // if signed

In a way that will not use more memory and also be compatible with AVR 
and ARM.

just my 2c,
Alain


Ole Reinhardt escreveu:
> Hi all,
> 
> just thinking again about the lastest fix in the tcp retransmission
> code.
> 
> The main problem was that the retransmission timer overflows after
> approximatly 65 seconds. This was mainly caused by the size of the
> variable holding the packet send time. It's an unsigned short. 
> 
> The quick fix was to always set the lowest bit. I'm not shure if this
> might not lead to new errors as this could also lead to a value in the
> future (if the lowest bit ist not yet set.). Ok, perhaps this fix does
> not cause any problems at all. At least I did not read the whole code.
> 
> But I'd like to suggest to use larger variables for the retransmission
> time. Why not use u_long instead of u_short? Ok, on AVR it might cost a
> little more time to calculate, but for simple additions and
> substractions 32bit calculations are not that expensive and using larger
> variables would be much cleaner code in my eyes.
> 
> What's your opinion?
> 
> Regards,
> 
> Ole Reinhardt
> 



More information about the En-Nut-Discussion mailing list