mirror of
https://github.com/chatmail/core.git
synced 2026-10-03 03:30:36 +03:00
fix: ensure same-second primary transport change propagates correctly
Without the fix, too fast transport changes are ignored at the receiver side.
This commit is contained in:
+11
-8
@@ -788,16 +788,19 @@ impl Context {
|
||||
(addr,),
|
||||
)?;
|
||||
|
||||
// Update the timestamp for the primary transport
|
||||
// so it becomes the first in `get_all_self_addrs()` list
|
||||
// and the list of relays distributed in the public key.
|
||||
// This ensures that messages will be sent
|
||||
// to the primary relay by the contacts
|
||||
// and will be fetched in background_fetch()
|
||||
// which only fetches from the primary transport.
|
||||
// `is_published=1`: an unpublished primary would be missing
|
||||
// from the relay list in the public key, so contacts would
|
||||
// never send to it.
|
||||
//
|
||||
// The timestamp must strictly increase because
|
||||
// other devices ignore the row update otherwise,
|
||||
// and contacts only adopt the re-signed key
|
||||
// if its signature timestamp increases.
|
||||
transaction
|
||||
.execute(
|
||||
"UPDATE transports SET add_timestamp=?, is_published=1 WHERE addr=?",
|
||||
"UPDATE transports
|
||||
SET add_timestamp=MAX(?, add_timestamp+1), is_published=1
|
||||
WHERE addr=?",
|
||||
(time(), addr),
|
||||
)
|
||||
.context(
|
||||
|
||||
Reference in New Issue
Block a user