diff --git a/src/server.c b/src/server.c index 7da6c33..a0f8892 100644 --- a/src/server.c +++ b/src/server.c @@ -1242,6 +1242,8 @@ static int frame_ack(patty_ax25_server *server, patty_ax25_frame *frame) { sock->rx_pending = 0; + patty_timer_start(&sock->timer_t3); + if (patty_ax25_sock_ack(sock, frame->nr) > 0) { /* * 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. */ 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) { @@ -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 * its send state variable V(S) to the received N(R). It may then * 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, max = sock->vs; @@ -1277,8 +1286,6 @@ static int frame_ack(patty_ax25_server *server, if (frame->nr >= min && frame->nr <= max) { sock->vs = frame->nr; sock->retries = sock->n_retry; - - patty_timer_start(&sock->timer_t1); } }