From 2e56ae55eb83d8cbe573a024b67c6b5b7cb036bc Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Thu, 6 Aug 2020 00:34:13 -0400 Subject: [PATCH] Allow setting retry count with setsockopt() Allow setting retry count with patty_client_setsockopt() --- include/patty/ax25/sock.h | 2 ++ include/patty/client.h | 3 ++- src/server.c | 1 + src/sock.c | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/patty/ax25/sock.h b/include/patty/ax25/sock.h index 05ebf92..bdd5c35 100644 --- a/include/patty/ax25/sock.h +++ b/include/patty/ax25/sock.h @@ -134,6 +134,8 @@ void patty_ax25_sock_ack_set(patty_ax25_sock *sock, time_t ack); void patty_ax25_sock_window_set(patty_ax25_sock *sock, size_t window); +void patty_ax25_sock_retry_set(patty_ax25_sock *sock, size_t retry); + void patty_ax25_sock_params_upgrade(patty_ax25_sock *sock); void patty_ax25_sock_params_max(patty_ax25_sock *sock); diff --git a/include/patty/client.h b/include/patty/client.h index 1a8bccd..82aa104 100644 --- a/include/patty/client.h +++ b/include/patty/client.h @@ -58,7 +58,8 @@ typedef struct _patty_client_setsockopt_request { typedef struct _patty_client_setsockopt_params { size_t mtu, - window; + window, + retry; time_t ack; } patty_client_setsockopt_params; diff --git a/src/server.c b/src/server.c index 5667fb3..ec812d6 100644 --- a/src/server.c +++ b/src/server.c @@ -600,6 +600,7 @@ static int server_setsockopt(patty_ax25_server *server, if (data.mtu) patty_ax25_sock_mtu_set(sock, data.mtu); if (data.window) patty_ax25_sock_window_set(sock, data.window); if (data.ack) patty_ax25_sock_ack_set(sock, data.ack); + if (data.retry) patty_ax25_sock_retry_set(sock, data.retry); if (data.mtu || data.window) { if (patty_ax25_sock_realloc_bufs(sock) < 0) { diff --git a/src/sock.c b/src/sock.c index db6fd27..1fd3b6d 100644 --- a/src/sock.c +++ b/src/sock.c @@ -239,6 +239,10 @@ void patty_ax25_sock_window_set(patty_ax25_sock *sock, size_t window) { sock->n_window_tx = window; } +void patty_ax25_sock_retry_set(patty_ax25_sock *sock, size_t retry) { + sock->n_retry = retry; +} + void patty_ax25_sock_params_upgrade(patty_ax25_sock *sock) { if (sock->version >= PATTY_AX25_2_2) { return;