From b37ea9f27430ba38cd13182caedc1c812ae4ca16 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sat, 20 Nov 2021 23:24:31 +0800 Subject: [PATCH] server: fix default keepalive not working --- src/server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server.c b/src/server.c index f9113af..5b72c4e 100644 --- a/src/server.c +++ b/src/server.c @@ -437,13 +437,12 @@ int main(int argc, char **argv) { #if LWS_LIBRARY_VERSION_NUMBER >= 4000000 case 'P': { int interval = parse_int("ping-interval", optarg); - if (interval <= 0) { + if (interval < 0) { fprintf(stderr, "ttyd: invalid ping interval: %s\n", optarg); return -1; } retry.secs_since_valid_ping = interval; retry.secs_since_valid_hangup = interval + 7; - info.retry_and_idle_policy = &retry; } break; #endif case '6': @@ -511,6 +510,8 @@ int main(int argc, char **argv) { #if LWS_LIBRARY_VERSION_NUMBER < 4000000 info.ws_ping_pong_interval = 5; +#else + info.retry_and_idle_policy = &retry; #endif if (strlen(iface) > 0) { -- 2.43.4