Stop Timer T1 upon receipt of DM during disconnect

This commit is contained in:
XANTRONIX Development 2020-08-07 21:50:01 -04:00 committed by XANTRONIX Industrial
parent 82dd1d50a8
commit a3995c7e88

View file

@ -1359,12 +1359,14 @@ static int handle_dm(patty_ax25_server *server,
patty_ax25_if *iface,
patty_ax25_sock *sock,
patty_ax25_frame *frame) {
int client;
if (sock == NULL || sock->state != PATTY_AX25_SOCK_PENDING_CONNECT) {
if (sock == NULL) {
return 0;
}
switch (sock->state) {
case PATTY_AX25_SOCK_PENDING_CONNECT: {
int client;
if ((client = client_by_sock(server, sock)) < 0) {
goto error_client_by_sock;
}
@ -1372,6 +1374,16 @@ static int handle_dm(patty_ax25_server *server,
patty_ax25_sock_reset(sock);
return respond_connect(client, -1, ECONNREFUSED);
}
case PATTY_AX25_SOCK_PENDING_DISCONNECT:
patty_timer_stop(&sock->timer_t1);
return sock_close(server, sock);
default:
break;
}
error_client_by_sock:
return -1;