From 7ae3ca84c085a2a5c90aa199d32aeb39fce9e340 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Sat, 23 May 2026 17:07:25 -0700 Subject: [PATCH] client, server: interpret monitor ackAny percentage as a fraction A "N%" ackAny was computed as percent*queueSize on the client and percent*limit on the server, without dividing by 100, then clamped to the queue size. Any percentage >= 1% therefore saturated to the full queue, so ackAny="50%" behaved as 100% and defeated percentage-style ack control. Divide the clamped percent by 100 on both the client (clientmon.cpp) and server (servermon.cpp) parsing paths. Note: this changes the negotiated ack threshold for existing percentage ackAny requests. --- src/clientmon.cpp | 2 +- src/servermon.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clientmon.cpp b/src/clientmon.cpp index 288f1ec..2e96993 100644 --- a/src/clientmon.cpp +++ b/src/clientmon.cpp @@ -782,7 +782,7 @@ std::shared_ptr MonitorBuilder::exec() try { auto percent = parseTo(sval.substr(0, sval.size()-1u)); if(percent>0.0 && percent<=100.0) { - op->ackAt = uint32_t(percent * op->queueSize); + op->ackAt = uint32_t(percent / 100.0 * op->queueSize); } else { throw std::invalid_argument("not in range (0%, 100%]"); } diff --git a/src/servermon.cpp b/src/servermon.cpp index 47c1a74..2a83926 100644 --- a/src/servermon.cpp +++ b/src/servermon.cpp @@ -561,7 +561,7 @@ void ServerConn::handle_MONITOR() if(sval.size()>1 && sval.back()=='%') { try { auto percent = parseTo(sval.substr(0, sval.size()-1u)); - op->ackAt = std::max(0.0, std::min(percent, 100.0)) * op->limit; + op->ackAt = std::max(0.0, std::min(percent, 100.0)) / 100.0 * op->limit; }catch(std::exception& e){ logRemote(ioid, Level::Crit, SB()<<"Unable to parse% "<