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,20 +1992,22 @@ int patty_ax25_server_run(patty_ax25_server *server) {
timersub(&after, &before, &server->elapsed); timersub(&after, &before, &server->elapsed);
if (handle_clients(server) < 0) {
goto error_io;
}
if (handle_ifaces(server) < 0) {
goto error_io;
}
if (handle_socks(server) < 0) { if (handle_socks(server) < 0) {
goto error_io; goto error_io;
} }
if (accept_client(server) < 0) { if (nready > 0) {
goto error_io; if (handle_clients(server) < 0) {
goto error_io;
}
if (handle_ifaces(server) < 0) {
goto error_io;
}
if (accept_client(server) < 0) {
goto error_io;
}
} }
} }