]> prime8.dev >> repos - ttyd.git/commitdiff
server: allow reconnect to be 0
authorShuanglei Tao <tsl0922@gmail.com>
Wed, 15 May 2019 12:21:24 +0000 (20:21 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Wed, 15 May 2019 12:33:06 +0000 (20:33 +0800)
src/server.c

index 73c07ab661dcc6ce5dbbc36c88fe20fedf15248a..c125c0c5d1bfdee33248fa47e07c3665924b8d1a 100644 (file)
@@ -331,7 +331,7 @@ main(int argc, char **argv) {
                 break;
             case 'r':
                 server->reconnect = atoi(optarg);
-                if (server->reconnect <= 0) {
+                if (server->reconnect < 0) {
                     fprintf(stderr, "ttyd: invalid reconnect: %s\n", optarg);
                     return -1;
                 }
@@ -448,7 +448,9 @@ main(int argc, char **argv) {
     lwsl_notice("  start command: %s\n", server->command);
     lwsl_notice("  close signal: %s (%d)\n", server->sig_name, server->sig_code);
     lwsl_notice("  terminal type: %s\n", server->terminal_type);
-    lwsl_notice("  reconnect timeout: %ds\n", server->reconnect);
+    if (server->reconnect > 0) {
+        lwsl_notice("  reconnect timeout: %ds\n", server->reconnect);
+    }
     if (server->check_origin)
         lwsl_notice("  check origin: true\n");
     if (server->url_arg)