Skip to content

Commit ff8206f

Browse files
committed
fix segmentation fault upon too many UDP connection. Also, accepts multiple connection in one cycle
1 parent 8298daf commit ff8206f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

sslh-select.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,15 @@ void main_loop(struct listen_endpoint listen_sockets[], int num_addr_listen)
156156
/* Check main socket for new connections */
157157
for (i = 0; i < num_addr_listen; i++) {
158158
if (FD_ISSET(listen_sockets[i].socketfd, &readfds)) {
159-
struct connection* new_cnx = cnx_accept_process(&fd_info, &listen_sockets[i]);
160-
161-
if (fd_out_of_range(new_cnx->q[0].fd))
162-
tidy_connection(new_cnx, &fd_info);
163-
164159
/* don't also process it as a read socket */
165160
FD_CLR(listen_sockets[i].socketfd, &readfds);
161+
162+
struct connection* new_cnx;
163+
while ((new_cnx = cnx_accept_process(&fd_info, &listen_sockets[i]))) {
164+
if (fd_out_of_range(new_cnx->q[0].fd))
165+
tidy_connection(new_cnx, &fd_info);
166+
}
167+
166168
}
167169
}
168170

0 commit comments

Comments
 (0)