From 458437edef19bc4ddcb0a5a9b41d337a33471398 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Mon, 28 Jun 2021 14:31:15 +0200 Subject: [Net] Add WebSocketServer handshake_timeout property. Allows customization of the maximum time a client is allowed to stay in the the "pending" state (i.e. awaiting HTTP handshake). This used to be 1 second by before, the new default is 3 seconds. --- modules/websocket/wsl_server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/websocket/wsl_server.cpp') diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp index 22bb1b6d1a..ccdb6e9292 100644 --- a/modules/websocket/wsl_server.cpp +++ b/modules/websocket/wsl_server.cpp @@ -95,8 +95,8 @@ bool WSLServer::PendingPeer::_parse_request(const Vector p_protocols) { return true; } -Error WSLServer::PendingPeer::do_handshake(const Vector p_protocols) { - if (OS::get_singleton()->get_ticks_msec() - time > WSL_SERVER_TIMEOUT) { +Error WSLServer::PendingPeer::do_handshake(const Vector p_protocols, uint64_t p_timeout) { + if (OS::get_singleton()->get_ticks_msec() - time > p_timeout) { return ERR_TIMEOUT; } if (use_ssl) { @@ -188,7 +188,7 @@ void WSLServer::poll() { List> remove_peers; for (List>::Element *E = _pending.front(); E; E = E->next()) { Ref ppeer = E->get(); - Error err = ppeer->do_handshake(_protocols); + Error err = ppeer->do_handshake(_protocols, handshake_timeout); if (err == ERR_BUSY) { continue; } else if (err != OK) { -- cgit v1.2.3