mirror of
https://github.com/tsl0922/ttyd.git
synced 2025-12-23 04:14:18 +01:00
Add support for the --max-clients option
This commit is contained in:
@@ -188,6 +188,10 @@ callback_tty(struct lws *wsi, enum lws_callback_reasons reason,
|
||||
lwsl_warn("refuse to serve WS client due to the --once option.\n");
|
||||
return 1;
|
||||
}
|
||||
if (server->max_clients > 0 && server->client_count == server->max_clients) {
|
||||
lwsl_warn("refuse to serve WS client due to the --max-clients option.\n");
|
||||
return 1;
|
||||
}
|
||||
if (lws_hdr_copy(wsi, buf, sizeof(buf), WSI_TOKEN_GET_URI) <= 0 || strcmp(buf, WS_PATH)) {
|
||||
lwsl_warn("refuse to serve WS client for illegal ws path: %s\n", buf);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user