Only handle clients and interfaces if select() >0

Only handle clients and interfaces if select() returns >0 in the main
event loop of patty_ax25_server_run(), to avoid unnecessary CPU
overhead
This commit is contained in:
XANTRONIX Development 2020-08-07 21:46:22 -04:00 committed by XANTRONIX Industrial
parent 98490f79a7
commit 58a0025c59

View file

@ -1992,6 +1992,11 @@ int patty_ax25_server_run(patty_ax25_server *server) {
timersub(&after, &before, &server->elapsed);
if (handle_socks(server) < 0) {
goto error_io;
}
if (nready > 0) {
if (handle_clients(server) < 0) {
goto error_io;
}
@ -2000,14 +2005,11 @@ int patty_ax25_server_run(patty_ax25_server *server) {
goto error_io;
}
if (handle_socks(server) < 0) {
goto error_io;
}
if (accept_client(server) < 0) {
goto error_io;
}
}
}
close(server->fd);