voelin-core: remember a server's addresses with the gateway's id

When voice connected while the gateway was already up, the bookmark's
voice address was not remembered with the server's unique id, so a later
visit without the gateway could not show the stored history before the
voice connection was up. Addresses are now remembered with the key in
use (the gateway's) whichever source reports last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
Claude committed 2026-09-28 03:01:30 +00:00
1 parent c1e96ac607
commit 0cebc10e3b
1 file changed
+4 -5
+4 -5
View File
@@ -558,12 +558,11 @@ impl Session {
/// A source told the server's unique id. The gateway's wins: its /// A source told the server's unique id. The gateway's wins: its
/// history is the one synced. `true` if the history key changed. /// history is the one synced. `true` if the history key changed.
fn learn_server_uid(&mut self, uid: String, from: Source) -> bool { fn learn_server_uid(&mut self, uid: String, from: Source) -> bool {
if from != Source::Gateway && self.gateway_client.is_some() { let gateway_key = self.state.server_uid.clone().filter(|_| self.gateway_client.is_some());
return false; let keep = from != Source::Gateway && gateway_key.is_some();
}
if from != Source::Query { if from != Source::Query {
let aliases = self.aliases.clone(); let aliases = self.aliases.clone();
let key = uid.clone(); let key = gateway_key.filter(|_| keep).unwrap_or_else(|| uid.clone());
self.history.current().run_then( self.history.current().run_then(
self.memory(), self.memory(),
move |s| aliases.iter().try_for_each(|a| s.set_server_alias(a, &key)), move |s| aliases.iter().try_for_each(|a| s.set_server_alias(a, &key)),
@@ -574,7 +573,7 @@ impl Session {
}, },
); );
} }
if self.state.server_uid.as_deref() == Some(uid.as_str()) { if keep || self.state.server_uid.as_deref() == Some(uid.as_str()) {
return false; return false;
} }
self.state.server_uid = Some(uid); self.state.server_uid = Some(uid);