-
Notifications
You must be signed in to change notification settings - Fork 704
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cool#9833: Mitigate connection count limitation, fix timeout-checking…
… code (*WIP*) This commit is a WIP, pushed for discussion and to be amended. (Cleaned up version with general code cleanups and Util artefacts removed for clarity) - All network limits and timeouts are configurable now, see COOLWSD { "net.ws.ping.timeout", "2000000" }, // WebSocketHandler ping timeout in us (2s). Zero disables metric. { "net.ws.ping.period", "3000000" }, // WebSocketHandler ping period in us (3s), i.e. duration until next ping. { "net.http.timeout", "30000000" }, // http::Session timeout in us (30s). Zero disables metric. { "net.maxconnections", "100000" }, // Socket maximum connections (100000). Zero disables metric. { "net.maxduration", "43200" }, // Socket maximum duration in seconds (12h). Zero disables metric. { "net.minbps", "0" }, // Socket minimum bits per seconds throughput (0). Increase for debugging. Zero disables metric. { "net.socketpoll.timeout", "64000000" }, // SocketPoll timeout in us (64s). and net::Defaults in NetUtil.hpp - ProtocolHandlerInterface::checkTimeout(..) is now called via StreamSocket::checkRemoval() to ensure tests even w/o input data (was: handlePoll()) - ProtocolHandlerInterface::checkTimeout(..) - Add bool return value: true -> shutdown connection, caller shall stop processing - Implemented for http::Session - Timeout (30s) net::Defaults::HTTPTimeout with missing response - Implemented for WebSocketHandler - Timeout (2s = net::Defaults::WSPingTimeout) after missing WS native frame ping/pong (server only) - StreamSocket -> Socket (properties moved) - bytes sent/received - closed state - Socket (added properties) - creation- and last-seen -time - socket type and port - checkRemoval(..) - called directly from SocketPoll::poll() - only for IPv4/v6 network connections - similar to ProtocolHandlerInterface::checkTimeout(..) - added further criteria (age, throughput, ..) - Timeout (64s = net::Defaults::SocketPollTimeout) if (now - lastSeen) > timeout - Timeout (12 hours) net::Defaults::MaxDuration if (now - creationTime) > timeout - TODO: Throughput/bandwitdh disabled, find proper metrics/timing - TODO: Add maximimal IPv4/IPv6 socket-count criteria, drop oldest. - SocketPoll::poll() - Additionally erases if !socket->isOpen() || socket->checkRemoval() Signed-off-by: Sven Göthel <[email protected]> Change-Id: I7e1a9329e0848c40a210f6250e29e26950da6fbc
- Loading branch information
Sven Göthel
committed
Sep 6, 2024
1 parent
9da6eb8
commit 6fc374e
Showing
18 changed files
with
1,429 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.