"Henry Hewgill" <23*1*7*
8@s*u*e*t*u*a*e*u*a*> wrote:
> Instead of testing if you're an outstanding (unacknowledged) sender by checking if 'nextdatatosend != ackexpected' I'm testing if 'lasttimer != NULLTIMER', and updating 'lasttimer = NULLTIMER' when I stop it after receiving a valid acknowledgement.
Yes, such approaches work as well - you're using the fact that a timer is still 'running' as a Boolean value, which is the same as checking the equivalence of two integer values. However, as those integer values have a *value* that reflects how future frames should be numbered, you'll need to also keep updating it.
Don't forget to set the value of your timer to NULLTIMER, both when the ack arrives AND when/if the timer times-out.