mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
proxy_client: fetch the value announced by a push of a stale session
When a push carries the session of a previous client, it is dropped and the subscriptions are sent again so the proxy learns the current session. But they were sent as refreshes, which the proxy answers with no values: the value announced by the dropped push was still lost. That value is typically the connection request of an incoming call. The proxy notifies with another session when another instance of the client subscribed last: on Android, the instance that ran before the account was restarted in doze, the new one being unable to subscribe yet; on iOS, the notification extension, while the app resumes with its account still active. Send them as full subscriptions, which also return the stored values. The listener value cache drops the values already received. Co-authored-by: Copilot (Claude Opus 5.5) <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
70a5f4d7ef
commit
30d2f2b830
1 file changed
+5
-2
@@ -1219,11 +1219,13 @@ DhtProxyClient::restartListeners(const asio::error_code& ec)
|
||||
// now, so the server learns the session id of this run: healthy
|
||||
// listeners are skipped by the loop below, and would otherwise
|
||||
// never be subscribed for push at all.
|
||||
// Also set after a push of a stale session was dropped: ask for the
|
||||
// stored values too, or the value that push announced is lost.
|
||||
if (logger_)
|
||||
logger_->debug("[proxy:client] [listeners] sending deferred push subscriptions");
|
||||
for (auto& search : searches_)
|
||||
for (auto& listener : search.second.listeners)
|
||||
resubscribe(search.first, listener.first, listener.second);
|
||||
resubscribe(search.first, listener.first, listener.second, true);
|
||||
return;
|
||||
}
|
||||
if (logger_)
|
||||
@@ -1288,7 +1290,8 @@ DhtProxyClient::pushNotificationReceived([[maybe_unused]] const std::map<std::st
|
||||
// A mismatch proves the server still has a listener registered under a previous
|
||||
// session: it keeps waking this device for notifications that can only be
|
||||
// discarded, and the values they announce are never fetched. Ask for the
|
||||
// subscriptions to be sent again so the server learns the current session,
|
||||
// subscriptions to be sent again, with the values the server stores, so the server
|
||||
// learns the current session and the value announced by this push is not lost,
|
||||
// instead of waiting for an unrelated event to trigger one.
|
||||
//
|
||||
// restartListeners() is rate limited by its own timer: stale listeners notify in
|
||||
|
||||
Reference in new issue
Block a user