From 9e3d8c0200274502c5f00ffe6245df80eb6ea907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyrille=20B=C3=A9raud?= Date: Thu, 18 Jun 2026 07:51:31 -0400 Subject: [PATCH] proxy server: only send call pushes at high priority MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the priority-only heuristic in handlePushListen (highPriority = !expired && minPriority == 0) with isHighPriorityPush, so the proxy promotes a notification to high (urgent) push priority only for real-time call signaling. Previously every value published at the default priority 0 — including the frequent connection-request refreshes that carry an empty pushType — triggered a high-priority push. On mobile this floods the platform's adaptive high-priority quota; once tripped, the platform silently drops genuine call pushes, so incoming calls fail to ring while the device is in the background. Restricting high priority to audioCall/videoCall keeps calls waking the device while the surrounding presence/sync noise is delivered at normal priority. This is a strict subset of the previous high-priority set, so no notification that was normal before becomes high. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/dht_proxy_server.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index 29757ce9..5f89688e 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -1195,20 +1195,23 @@ DhtProxyServer::handlePushListen(const InfoHash& infoHash, json["exp"] = json["ids"]; } - auto minPriority = 1000u; - for (const auto& v : values) - minPriority = std::min(minPriority, v->priority); + const bool highPriority = isHighPriorityPush(values, expired); - if (logger_) - logger_->debug("[proxy:server] [listen {}] [client {}] [session {}] [expired {}] [priority {}] [values {}]", + if (logger_) { + auto minPriority = 1000u; + for (const auto& v : values) + minPriority = std::min(minPriority, v->priority); + logger_->debug("[proxy:server] [listen {}] [client {}] [session {}] [expired {}] [priority {}] [high {}] [values {}]", infoHash, clientId, sessionCtx->sessionId, expired, minPriority, + highPriority, values.size()); + } - sendPushNotification(pushToken, std::move(json), type, !expired and minPriority == 0, topic); + sendPushNotification(pushToken, std::move(json), type, highPriority, topic); return true; }