From 8d58409481efd3f6d648abe168ff483775f32359 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 16 Oct 2023 18:32:26 -0700 Subject: [PATCH] server: check tx buffer limit to throttle The TX buffer could grow while nothing is being received. Practically bounded by the timeout interval, but could still get quite large in that time. --- src/servermon.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/servermon.cpp b/src/servermon.cpp index dae40c7..27c4244 100644 --- a/src/servermon.cpp +++ b/src/servermon.cpp @@ -90,7 +90,9 @@ struct MonitorOp final : public ServerOp if(!conn || conn->state==ConnBase::Disconnected) return; - if(conn->connection() && (bufferevent_get_enabled(conn->connection())&EV_READ)) { + auto bev(conn->connection()); + + if(bev && evbuffer_get_length(bufferevent_get_output(bev)) < conn->tcp_tx_limit) { doReply(op); } else { // connection TX queue is too full