From 0613d412a259890b45545008411c951963c5b8a4 Mon Sep 17 00:00:00 2001 From: yrutschle Date: Sat, 3 Apr 2021 21:34:47 +0200 Subject: [PATCH] refactor: write activity checked on select output rather than on each connection object --- sslh-select.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sslh-select.c b/sslh-select.c index 0ae10df..5772bd1 100644 --- a/sslh-select.c +++ b/sslh-select.c @@ -459,14 +459,9 @@ void main_loop(struct listen_endpoint listen_sockets[], int num_addr_listen) } /* Check all sockets for write activity */ - for (i = 0; i < collection_get_length(fd_info.collection); i++) { - struct connection* cnx = collection_get_cnx_from_index(fd_info.collection, i); - if (cnx->q[0].fd != -1) { - for (j = 0; j < 2; j++) { - if (is_fd_active(cnx->q[j].fd, &writefds)) { - cnx_write_process(&fd_info, cnx->q[j].fd); - } - } + for (i = 0; i < fd_info.max_fd; i++) { + if (FD_ISSET(i, &writefds)) { + cnx_write_process(&fd_info, i); } }