mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-13 07:37:15 +03:00
fix off-by-one error that would sometime ignore the latest connection
This commit is contained in:
parent
5f1c1b1b61
commit
1799a81079
@ -67,7 +67,7 @@ static void watchers_init(watchers** w, struct listen_endpoint* listen_sockets,
|
|||||||
void watchers_add_read(watchers* w, int fd)
|
void watchers_add_read(watchers* w, int fd)
|
||||||
{
|
{
|
||||||
FD_SET(fd, &w->fds_r);
|
FD_SET(fd, &w->fds_r);
|
||||||
if (fd > w->max_fd)
|
if (fd + 1 > w->max_fd)
|
||||||
w->max_fd = fd + 1;
|
w->max_fd = fd + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ void main_loop(struct listen_endpoint listen_sockets[], int num_addr_listen)
|
|||||||
|
|
||||||
print_message(msg_fd, "selecting... max_fd=%d num_probing=%d\n",
|
print_message(msg_fd, "selecting... max_fd=%d num_probing=%d\n",
|
||||||
fd_info.watchers->max_fd, fd_info.num_probing);
|
fd_info.watchers->max_fd, fd_info.num_probing);
|
||||||
res = select(fd_info.watchers->max_fd + 1, &readfds, &writefds,
|
res = select(fd_info.watchers->max_fd, &readfds, &writefds,
|
||||||
NULL, fd_info.num_probing ? &tv : NULL);
|
NULL, fd_info.num_probing ? &tv : NULL);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
perror("select");
|
perror("select");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user