From: Shuanglei Tao Date: Tue, 26 Nov 2019 13:55:42 +0000 (+0800) Subject: server: remove the sleep from main loop X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=6d69f0a55d4e7e647d949f8608dc8501ebfa9e52;p=ttyd.git server: remove the sleep from main loop --- diff --git a/src/protocol.c b/src/protocol.c index 559da60..5668203 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -216,7 +216,7 @@ tty_client_poll(struct tty_client *client) { fd_set des_set; FD_ZERO (&des_set); FD_SET (client->pty, &des_set); - struct timeval tv = { 0, 0 }; + struct timeval tv = { 0, 5000 }; // 5ms if (select(client->pty + 1, &des_set, NULL, NULL, &tv) <= 0) return; if (FD_ISSET (client->pty, &des_set)) { diff --git a/src/server.c b/src/server.c index 9757736..2ba0927 100644 --- a/src/server.c +++ b/src/server.c @@ -503,7 +503,6 @@ main(int argc, char **argv) { } } lws_service(context, 0); - usleep(10 * 1000); // 10ms } lws_context_destroy(context);