Stop Timer T2 when sending RR on k/2 unacked

When handling I frames, stop Timer T2 if the number of unacknowledged
frames has reached k/2

Other changes:

    * Provide annotations from the AX.25 v2.2 standards document

    * Improve implementation of I frame reception P/F procedure
This commit is contained in:
XANTRONIX Development 2020-08-22 22:57:35 -05:00 committed by XANTRONIX Industrial
parent 3b1e341851
commit 99a48af087

View file

@ -1616,11 +1616,30 @@ static int handle_i(patty_ax25_server *server,
}
}
if (++sock->rx_pending == sock->n_window_rx / 2) {
if (frame->pf || ++sock->rx_pending == sock->n_window_rx / 2) {
/*
* AX.25 v2.2 Section 6.7.1.2 "Response Delay Timer T2"
*
* Timer T2, the Response Delay Timer, may optionally be implemented
* by the TNC to specify a maximum amount of delay to be introduced
* between the time an I frame is received and the time the resulting
* response frame is sent. This delay is introduced to allow a
* receiving TNC to wait a short period of time to determine if more
* than one frame is being sent to it. If more frames are received,
* the TNC can acknowledge them at once (up to seven),
* rather than acknowledging each individual frame. The use of Timer
* T2 is not required; it is simply recommended to improve channel
* efficiency. Note that to achieve maximum throughput on full-duplex
* channels, acknowledgements should not be delayed beyond k/2
* frames. The k parameter is defined in Section 6.8.2.3.
*/
sock->rx_pending = 0;
patty_timer_stop(&sock->timer_t2);
/*
* AX.25 v2.2 Section 6.2 "Poll/Final (P/F) Bit Procedures"
*/
return frame->pf?
patty_ax25_sock_send_rr(sock, PATTY_AX25_FRAME_RESPONSE, 1): 0;
}
@ -1628,13 +1647,6 @@ static int handle_i(patty_ax25_server *server,
patty_timer_start(&sock->timer_t2);
patty_timer_start(&sock->timer_t3);
/*
* AX.25 v2.2 Section 6.2 "Poll/Final (P/F) Bit Procedures"
*/
if (frame->pf == 1) {
return patty_ax25_sock_send_rr(sock, PATTY_AX25_FRAME_RESPONSE, 1);
}
return 0;
error_handle_segment: