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:
parent
98490f79a7
commit
58a0025c59
1 changed files with 12 additions and 10 deletions
10
src/server.c
10
src/server.c
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue