From 6d69f0a55d4e7e647d949f8608dc8501ebfa9e52 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Tue, 26 Nov 2019 21:55:42 +0800 Subject: [PATCH] server: remove the sleep from main loop --- src/protocol.c | 2 +- src/server.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) 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); -- 2.43.4