Better management of Timers T1 and T3

Changes:

    * Ensure Timer T1 is stopped when Timer T3 is active

    * Ensure Timer T1 is started when an acknowledgement from the peer
      does not acknowledge all I frames previously sent
This commit is contained in:
XANTRONIX Development 2020-08-23 17:37:34 -05:00 committed by XANTRONIX Industrial
parent 25f2a0abe9
commit fcef17a8b1

View file

@ -1242,6 +1242,8 @@ static int frame_ack(patty_ax25_server *server,
patty_ax25_frame *frame) { patty_ax25_frame *frame) {
sock->rx_pending = 0; sock->rx_pending = 0;
patty_timer_start(&sock->timer_t3);
if (patty_ax25_sock_ack(sock, frame->nr) > 0) { if (patty_ax25_sock_ack(sock, frame->nr) > 0) {
/* /*
* AX.25 v2.2, Section 6.4.6 "Receiving Acknowledgement" * AX.25 v2.2, Section 6.4.6 "Receiving Acknowledgement"
@ -1255,6 +1257,10 @@ static int frame_ack(patty_ax25_server *server,
* acknowledged, Timer T1 is started again. * acknowledged, Timer T1 is started again.
*/ */
patty_timer_stop(&sock->timer_t1); patty_timer_stop(&sock->timer_t1);
if (patty_ax25_sock_ack_pending(sock) > 0) {
patty_timer_start(&sock->timer_t1);
}
} }
if (PATTY_AX25_FRAME_CONTROL_S(frame->control) && frame->pf) { if (PATTY_AX25_FRAME_CONTROL_S(frame->control) && frame->pf) {
@ -1266,6 +1272,9 @@ static int frame_ack(patty_ax25_server *server,
* to the last N(S) sent plus one, the TNC restarts Timer T1 and sets * to the last N(S) sent plus one, the TNC restarts Timer T1 and sets
* its send state variable V(S) to the received N(R). It may then * its send state variable V(S) to the received N(R). It may then
* resume with I frame transmission or retransmission, as appropriate. * resume with I frame transmission or retransmission, as appropriate.
*
* Errata: It is not necessary, strictly speaking, to start Timer T1
* until the moment there are I frames ready to be sent to the peer.
*/ */
int min = sock->va, int min = sock->va,
max = sock->vs; max = sock->vs;
@ -1277,8 +1286,6 @@ static int frame_ack(patty_ax25_server *server,
if (frame->nr >= min && frame->nr <= max) { if (frame->nr >= min && frame->nr <= max) {
sock->vs = frame->nr; sock->vs = frame->nr;
sock->retries = sock->n_retry; sock->retries = sock->n_retry;
patty_timer_start(&sock->timer_t1);
} }
} }