fix: Only emit TransportsModified if transports are really modified

Otherwise it's not possible to write tests reliably because sync messages may be executed multiple
times if they arrive from different transports. This should fix flaky
`test_transport_synchronization`.

Also always emit `TransportsModified` if the primary transport is changed by a sync message, even if
it doesn't contain `SyncData::Transports`.

Also don't decrease `add_timestamp` in `save_transport()` if nothing else changes, this doesn't make
sense.
This commit is contained in:
iequidoo
2026-01-10 23:07:16 -03:00
committed by iequidoo
parent ed300b6f97
commit fe3b1ea16d
3 changed files with 25 additions and 13 deletions

View File

@@ -832,7 +832,9 @@ pub(crate) async fn receive_imf_inner(
let transport_changed = if transport_exists {
transaction.execute(
"UPDATE config SET value=? WHERE keyname='configured_addr'",
"
UPDATE config SET value=? WHERE keyname='configured_addr' AND value!=?1
",
(from_addr,),
)? > 0
} else {
@@ -848,6 +850,7 @@ pub(crate) async fn receive_imf_inner(
if transport_changed {
info!(context, "Primary transport changed to {from_addr:?}.");
context.sql.uncache_raw_config("configured_addr").await;
context.emit_event(EventType::TransportsModified);
}
} else {
warn!(context, "Sync items are not encrypted.");