mirror of https://github.com/martanne/abduco
Don't wait for clients to be present inorder to read program I/O
Previously the underlying application would block on I/O because we would wait to read it until a client is connected to display the information. This prevented long running tasks from making progress. However with the new approach output data of programs which terminate while no client is connected is lost.
This commit is contained in:
parent
6084fb4893
commit
b205eeea9a
6
server.c
6
server.c
|
|
@ -225,10 +225,8 @@ static void server_mainloop() {
|
|||
if (FD_ISSET(server.socket, &readfds))
|
||||
server_accept_client(now);
|
||||
|
||||
if (FD_ISSET(server.pty, &readfds)) {
|
||||
if (FD_ISSET(server.pty, &readfds))
|
||||
pty_data = server_read_pty(&server.pty_output);
|
||||
clients_ready = !pty_data;
|
||||
}
|
||||
|
||||
for (Client **prev_next = &server.clients, *c = server.clients; c;) {
|
||||
if (c->state == STATE_DISCONNECTED) {
|
||||
|
|
@ -297,7 +295,7 @@ static void server_mainloop() {
|
|||
c = c->next;
|
||||
}
|
||||
|
||||
if (clients_ready && server.clients && server.running)
|
||||
if (server.running && clients_ready)
|
||||
FD_SET_MAX(server.pty, &new_readfds, new_fdmax);
|
||||
|
||||
if (FD_ISSET(server.pty, &writefds)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue