Use Timer T1 for timeouts on XID negotiations
When a remote station wishes to connect by sending an XID frame, use Timer T1 to send an XID response up to the retry count before closing the socket pending negotiation
This commit is contained in:
parent
893ddefd57
commit
1e4329528c
1 changed files with 23 additions and 2 deletions
25
src/server.c
25
src/server.c
|
@ -1679,7 +1679,8 @@ static int handle_xid(patty_ax25_server *server,
|
|||
*/
|
||||
if ((local = sock_by_addr(server->socks_local,
|
||||
&frame->dest)) != NULL) {
|
||||
int client;
|
||||
int ret,
|
||||
client;
|
||||
|
||||
if (local->state != PATTY_AX25_SOCK_LISTENING) {
|
||||
goto reply_dm;
|
||||
|
@ -1713,7 +1714,11 @@ static int handle_xid(patty_ax25_server *server,
|
|||
goto error_sock_save;
|
||||
}
|
||||
|
||||
return patty_ax25_sock_send_xid(remote, PATTY_AX25_FRAME_RESPONSE);
|
||||
ret = patty_ax25_sock_send_xid(remote, PATTY_AX25_FRAME_RESPONSE);
|
||||
|
||||
patty_timer_start(&remote->timer_t1, remote->n_ack);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
reply_dm:
|
||||
|
@ -1927,6 +1932,22 @@ static int handle_sock(uint32_t key,
|
|||
patty_timer_tick(&sock->timer_t3, &server->elapsed);
|
||||
|
||||
switch (sock->state) {
|
||||
case PATTY_AX25_SOCK_PENDING_ACCEPT:
|
||||
if (patty_timer_expired(&sock->timer_t1)) {
|
||||
if (sock->retries) {
|
||||
int ret = patty_ax25_sock_send_xid(sock, PATTY_AX25_FRAME_RESPONSE);
|
||||
|
||||
sock->retries--;
|
||||
patty_timer_start(&sock->timer_t1, sock->n_ack);
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
(void)sock_close(server, sock);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
case PATTY_AX25_SOCK_PENDING_CONNECT:
|
||||
if (patty_timer_expired(&sock->timer_t1)) {
|
||||
if (sock->retries) {
|
||||
|
|
Loading…
Add table
Reference in a new issue