mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
proxy server: only send call pushes at high priority
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>
This commit is contained in:
1 parent
e0ecf06f52
commit
9e3d8c0200
1 file changed
+9
-6
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user