Add closeOnBackpressureLimit option

This commit is contained in:
Alex Hultman
2021-01-26 12:18:31 +01:00
parent 359c26b0bf
commit 12d8b192a1
4 changed files with 13 additions and 1 deletions
+6
View File
@@ -64,6 +64,7 @@ public:
/* There needs to be a maxBackpressure which will force close everything over that limit */
size_t maxBackpressure = 0;
bool closeOnBackpressureLimit;
/* Each websocket context has a topic tree for pub/sub */
TopicTree topicTree;
@@ -143,6 +144,11 @@ public:
/* If we have too much backpressure, simply skip sending from here */
/* Also (defer) a close if we have too much backpressure if that is what we want */
if (maxBackpressure && closeOnBackpressureLimit && asyncSocket->getBufferedAmount() > maxBackpressure) {
us_socket_shutdown_read(SSL, (us_socket_t *) asyncSocket);
}
/* Reserved, unused */
return 0;
}) {