From 451520af975c978c8ffaa1d9a0959b50c1b8e294 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 04:54:50 +0200 Subject: Adding upstream version 1.7.7. Signed-off-by: Daniel Baumann --- src/server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/server.c') diff --git a/src/server.c b/src/server.c index 9c8f118..39f40e9 100644 --- a/src/server.c +++ b/src/server.c @@ -77,12 +77,13 @@ static const struct option options[] = {{"port", required_argument, NULL, 'p'}, {"check-origin", no_argument, NULL, 'O'}, {"max-clients", required_argument, NULL, 'm'}, {"once", no_argument, NULL, 'o'}, + {"exit-no-conn", no_argument, NULL, 'q'}, {"browser", no_argument, NULL, 'B'}, {"debug", required_argument, NULL, 'd'}, {"version", no_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, 0, 0}}; -static const char *opt_string = "p:i:U:c:H:u:g:s:w:I:b:P:6aSC:K:A:Wt:T:Om:oBd:vh"; +static const char *opt_string = "p:i:U:c:H:u:g:s:w:I:b:P:6aSC:K:A:Wt:T:Om:oqBd:vh"; static void print_help() { // clang-format off @@ -108,6 +109,7 @@ static void print_help() { " -O, --check-origin Do not allow websocket connection from different origin\n" " -m, --max-clients Maximum clients to support (default: 0, no limit)\n" " -o, --once Accept only one client and exit on disconnection\n" + " -q, --exit-no-conn Exit on all clients disconnection\n" " -B, --browser Open terminal with the default system browser\n" " -I, --index Custom index.html path\n" " -b, --base-path Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)\n" @@ -150,6 +152,7 @@ static void print_config() { if (server->url_arg) lwsl_notice(" allow url arg: true\n"); if (server->max_clients > 0) lwsl_notice(" max clients: %d\n", server->max_clients); if (server->once) lwsl_notice(" once: true\n"); + if (server->exit_no_conn) lwsl_notice(" exit_no_conn: true\n"); if (server->index != NULL) lwsl_notice(" custom index.html: %s\n", server->index); if (server->cwd != NULL) lwsl_notice(" working directory: %s\n", server->cwd); if (!server->writable) lwsl_notice("The --writable option is not set, will start in readonly mode"); @@ -367,6 +370,9 @@ int main(int argc, char **argv) { case 'o': server->once = true; break; + case 'q': + server->exit_no_conn = true; + break; case 'B': browser = true; break; -- cgit v1.2.3