mirror of
https://github.com/yrutschle/sslh.git
synced 2025-05-10 12:11:04 +03:00
fix segmentation fault upon too many UDP connection. Also, accepts multiple connection in one cycle
This commit is contained in:
parent
8298daf686
commit
ff8206f7c8
@ -156,13 +156,15 @@ void main_loop(struct listen_endpoint listen_sockets[], int num_addr_listen)
|
|||||||
/* Check main socket for new connections */
|
/* Check main socket for new connections */
|
||||||
for (i = 0; i < num_addr_listen; i++) {
|
for (i = 0; i < num_addr_listen; i++) {
|
||||||
if (FD_ISSET(listen_sockets[i].socketfd, &readfds)) {
|
if (FD_ISSET(listen_sockets[i].socketfd, &readfds)) {
|
||||||
struct connection* new_cnx = cnx_accept_process(&fd_info, &listen_sockets[i]);
|
|
||||||
|
|
||||||
if (fd_out_of_range(new_cnx->q[0].fd))
|
|
||||||
tidy_connection(new_cnx, &fd_info);
|
|
||||||
|
|
||||||
/* don't also process it as a read socket */
|
/* don't also process it as a read socket */
|
||||||
FD_CLR(listen_sockets[i].socketfd, &readfds);
|
FD_CLR(listen_sockets[i].socketfd, &readfds);
|
||||||
|
|
||||||
|
struct connection* new_cnx;
|
||||||
|
while ((new_cnx = cnx_accept_process(&fd_info, &listen_sockets[i]))) {
|
||||||
|
if (fd_out_of_range(new_cnx->q[0].fd))
|
||||||
|
tidy_connection(new_cnx, &fd_info);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user