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.
This commit is contained in:
Michael Davidsaver
2023-10-16 18:32:26 -07:00
parent 289f508af6
commit 8d58409481
+3 -1
View File
@@ -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