Add resetIdleTimeoutOnSend

This commit is contained in:
Alex Hultman
2021-01-27 18:56:24 +01:00
parent 8253bb91d8
commit 90e61e88fd
3 changed files with 9 additions and 2 deletions
+4 -1
View File
@@ -65,6 +65,7 @@ public:
/* There needs to be a maxBackpressure which will force close everything over that limit */
size_t maxBackpressure = 0;
bool closeOnBackpressureLimit;
bool resetIdleTimeoutOnSend;
/* Each websocket context has a topic tree for pub/sub */
TopicTree topicTree;
@@ -134,7 +135,9 @@ public:
/* Note: this assumes we are not corked, as corking will swallow things and fail later on */
auto [written, failed] = asyncSocket->write(selectedData.data(), (int) selectedData.length());
if (!failed) {
asyncSocket->timeout(this->idleTimeout);
if (this->resetIdleTimeoutOnSend) {
asyncSocket->timeout(this->idleTimeout);
}
}
/* Failing here must not immediately close the socket, as that could result in stack overflow,