Better adherence to flow control semantics
This commit is contained in:
parent
37a03a15c7
commit
6d22d0286c
1 changed files with 10 additions and 15 deletions
15
src/server.c
15
src/server.c
|
@ -1438,7 +1438,7 @@ static int handle_i(patty_ax25_server *server,
|
|||
goto error_write;
|
||||
}
|
||||
|
||||
sock->va = frame->ns + 1;
|
||||
sock->va = frame->nr;
|
||||
|
||||
if (++sock->pending == sock->n_window_rx / 2) {
|
||||
sock->pending = 0;
|
||||
|
@ -1513,7 +1513,8 @@ static int handle_rr(patty_ax25_server *server,
|
|||
patty_ax25_sock_send_rnr(sock, PATTY_AX25_FRAME_RESPONSE, 1);
|
||||
|
||||
case PATTY_AX25_FRAME_RESPONSE:
|
||||
sock->vs = frame->nr;
|
||||
sock->flow = PATTY_AX25_SOCK_READY;
|
||||
sock->va = frame->nr;
|
||||
sock->retries = sock->n_retry;
|
||||
|
||||
fd_watch(server, sock->fd);
|
||||
|
@ -1548,15 +1549,13 @@ static int handle_rnr(patty_ax25_server *server,
|
|||
|
||||
case PATTY_AX25_FRAME_RESPONSE:
|
||||
sock->flow = PATTY_AX25_SOCK_WAIT;
|
||||
sock->vs = frame->nr;
|
||||
sock->va = frame->nr;
|
||||
sock->retries = sock->n_retry;
|
||||
|
||||
fd_clear(server, sock->fd);
|
||||
|
||||
patty_timer_start(&sock->timer_t3, PATTY_AX25_SOCK_DEFAULT_KEEPALIVE);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2028,8 +2027,7 @@ static int handle_sock(uint32_t key,
|
|||
/*
|
||||
* AX.25 v2.2, Section 6.4.1, "Sending I Frames"
|
||||
*/
|
||||
if (sock->flow == PATTY_AX25_SOCK_READY) {
|
||||
if (sock->vs % sock->n_window_tx == sock->n_window_tx - 1) {
|
||||
if (sock->vs == sock->va + sock->n_window_tx) {
|
||||
sock->flow = PATTY_AX25_SOCK_WAIT;
|
||||
|
||||
fd_clear(server, sock->fd);
|
||||
|
@ -2039,9 +2037,6 @@ static int handle_sock(uint32_t key,
|
|||
|
||||
return patty_ax25_sock_send_rr(sock, PATTY_AX25_FRAME_COMMAND, 1);
|
||||
}
|
||||
} else if (sock->flow == PATTY_AX25_SOCK_WAIT) {
|
||||
sock->flow = PATTY_AX25_SOCK_READY;
|
||||
}
|
||||
|
||||
if ((len = read(sock->fd, sock->rx_buf, sock->n_maxlen_rx)) < 0) {
|
||||
if (errno == EIO) {
|
||||
|
|
Loading…
Add table
Reference in a new issue