voelin-core: account updates that change something, clean restarts, app version

- SetMytsIdentity(None) while there is no account notified every voice
  connection anyway: in-flight handshakes restarted and connected servers
  got an `updatemytsid` clear (and a failed or late reply disconnects).
  Still no account is no change now.
- When the account changed right as a handshake finished, the connected
  client was dropped without a disconnect: the server kept it, with the old
  account, next to the new connection until it timed out. It leaves
  properly first now.
- client_meta_data said voelin-core's version (0.1.0), not the app's. It
  takes the version the app sets at start (crash::app_version, new).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEpqsPES27Eacue91u3d2Q
This commit is contained in:
Claude committed 2026-10-04 18:48:11 +00:00
1 parent b28802efa2
commit d1a95ccab4
4 files changed
+22 -3

No files matched your search

+10 -1
View File
@@ -861,7 +861,16 @@ async fn run(
};
let id = match command {
Command::SetMytsIdentity(identity) => {
myts_identity.send_replace(identity);
// Still no account is no change: every notification restarts
// handshakes and sends `updatemytsid` on every connection. Any
// account is (each connection's proof is signed anew).
myts_identity.send_if_modified(|current| {
if current.is_none() && identity.is_none() {
return false;
}
*current = identity;
true
});
continue;
}
Command::SetAudioSettings(new) => {
+3 -2
View File
@@ -108,7 +108,8 @@ fn compatibility_version(os: &str) -> Result<Version> {
pub fn client_metadata() -> String {
serde_json::json!({
"name": "Voelin",
"version": env!("CARGO_PKG_VERSION"),
// The app's version (it sets it at start), not this library's.
"version": voelin_platform::crash::app_version(),
"platform": std::env::consts::OS,
})
.to_string()
@@ -151,7 +152,7 @@ mod tests {
fn metadata_identifies_voelin_without_changing_signed_version() {
let metadata: serde_json::Value = serde_json::from_str(&client_metadata()).unwrap();
assert_eq!(metadata["name"], "Voelin");
assert_eq!(metadata["version"], env!("CARGO_PKG_VERSION"));
assert_eq!(metadata["version"], voelin_platform::crash::app_version());
assert_eq!(metadata["platform"], std::env::consts::OS);
}
+4
View File
@@ -390,6 +390,10 @@ async fn run_inner(
None => anyhow::bail!("connection closed"),
}
if identity.has_changed().unwrap_or(true) {
// Connected already: leave properly, or the server keeps a
// client with the old account until it times out, next to
// the new one.
let _ = shutdown_connection(con).await;
continue;
}
return Ok(con);
+5
View File
@@ -126,6 +126,11 @@ pub fn set_app_version(version: impl Into<String>) {
config().version = version.into();
}
/// The app's version ([`set_app_version`]), also what it tells servers.
pub fn app_version() -> String {
config().version.clone()
}
/// How many reports to keep (at least one).
pub fn set_keep(keep: usize) {
config().keep = keep.max(1);