diff --git a/include/patty/ax25/sock.h b/include/patty/ax25/sock.h index dac1ba2..355d91a 100644 --- a/include/patty/ax25/sock.h +++ b/include/patty/ax25/sock.h @@ -135,7 +135,7 @@ typedef struct _patty_ax25_sock { * Transmit and receive buffers */ void *tx_buf, - *rx_buf; + *io_buf; void *tx_slots; diff --git a/src/server.c b/src/server.c index db848a3..4f1871d 100644 --- a/src/server.c +++ b/src/server.c @@ -2042,7 +2042,7 @@ static int handle_sock_dgram(patty_ax25_server *server, return 0; } - if ((len = read(sock->fd, sock->rx_buf, sock->n_maxlen_rx)) < 0) { + if ((len = read(sock->fd, sock->io_buf, sock->n_maxlen_tx)) < 0) { if (errno == EIO) { (void)sock_close(server, sock); } else { @@ -2051,7 +2051,7 @@ static int handle_sock_dgram(patty_ax25_server *server, } else if (len == 0) { (void)sock_close(server, sock); } else if (len > 0) { - if (patty_ax25_sock_write(sock, sock->rx_buf, len) < 0) { + if (patty_ax25_sock_write(sock, sock->io_buf, len) < 0) { goto error_sock_write; } } @@ -2227,7 +2227,7 @@ static int handle_sock(uint32_t key, return 0; } - if ((len = read(sock->fd, sock->rx_buf, sock->n_maxlen_rx)) < 0) { + if ((len = read(sock->fd, sock->io_buf, sock->n_maxlen_tx)) < 0) { if (errno == EIO) { (void)sock_shutdown(server, sock); } else { @@ -2236,7 +2236,7 @@ static int handle_sock(uint32_t key, } else if (len == 0) { (void)sock_shutdown(server, sock); } else if (len > 0) { - if (patty_ax25_sock_write(sock, sock->rx_buf, len) < 0) { + if (patty_ax25_sock_write(sock, sock->io_buf, len) < 0) { goto error_sock_write; } diff --git a/src/sock.c b/src/sock.c index 27797a2..ca983ca 100644 --- a/src/sock.c +++ b/src/sock.c @@ -52,8 +52,8 @@ static inline size_t tx_bufsz(patty_ax25_sock *sock) { return PATTY_AX25_FRAME_OVERHEAD + sock->n_maxlen_tx; } -static inline size_t rx_bufsz(patty_ax25_sock *sock) { - return PATTY_AX25_FRAME_OVERHEAD + sock->n_maxlen_rx; +static inline size_t io_bufsz(patty_ax25_sock *sock) { + return PATTY_AX25_FRAME_OVERHEAD + sock->n_maxlen_tx; } static inline size_t tx_slots(patty_ax25_sock *sock) { @@ -96,8 +96,8 @@ static int init_bufs(patty_ax25_sock *sock) { goto error_realloc_tx_buf; } - if ((sock->rx_buf = realloc(sock->rx_buf, rx_bufsz(sock))) == NULL) { - goto error_realloc_rx_buf; + if ((sock->io_buf = realloc(sock->io_buf, io_bufsz(sock))) == NULL) { + goto error_realloc_io_buf; } if ((sock->tx_slots = realloc(sock->tx_slots, tx_slots_size(sock))) == NULL) { @@ -114,10 +114,10 @@ static int init_bufs(patty_ax25_sock *sock) { return 0; error_realloc_tx_slots: - free(sock->rx_buf); - sock->rx_buf = NULL; + free(sock->io_buf); + sock->io_buf = NULL; -error_realloc_rx_buf: +error_realloc_io_buf: free(sock->tx_buf); sock->tx_buf = NULL; @@ -189,7 +189,7 @@ patty_ax25_sock *patty_ax25_sock_new(enum patty_ax25_proto proto, error_init_bufs: if (sock->tx_slots) free(sock->tx_slots); - if (sock->rx_buf) free(sock->rx_buf); + if (sock->io_buf) free(sock->io_buf); if (sock->tx_buf) free(sock->tx_buf); error_bind_pty: @@ -220,8 +220,8 @@ void patty_ax25_sock_destroy(patty_ax25_sock *sock) { free(sock->tx_slots); } - if (sock->rx_buf) { - free(sock->rx_buf); + if (sock->io_buf) { + free(sock->io_buf); } if (sock->tx_buf) {