Make fd_clear() in src/server.c faster

This commit is contained in:
XANTRONIX Development 2020-07-21 17:44:18 -04:00 committed by XANTRONIX Industrial
parent 6711f37ab9
commit 5fa29da680

View file

@ -144,13 +144,15 @@ static inline void fd_clear(patty_ax25_server *server, int fd) {
FD_CLR(fd, &server->fds_watch);
for (i=0; i<8*sizeof(&server->fds_watch); i++) {
if (FD_ISSET(i, &server->fds_watch)) {
server->fd_max = i;
if (server->fd_max == fd + 1) {
for (i=0; i<8*sizeof(&server->fds_watch); i++) {
if (FD_ISSET(i, &server->fds_watch)) {
server->fd_max = i;
}
}
}
server->fd_max++;
server->fd_max++;
}
}
static patty_ax25_sock *sock_by_fd(patty_dict *dict,