abduco

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit b205eeea9a183d68cdcb874dfaea1e0f99249ef0
parent 6084fb4893e3afec9743b5df18a09bcb1a44032d
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu,  6 Mar 2014 12:58:15 +0100

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.

Diffstat:
server.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/server.c b/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)) {