Skip to content

Commit

Permalink
fixup! crypto: update sender data on /keys/query responses
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Sep 4, 2024
1 parent 7a9315a commit 385e666
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions crates/matrix-sdk-crypto/src/identities/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,15 @@ impl IdentityManager {
// user identities from the store, so this has to happen *after* the
// changes from `handle_cross_signing_keys` are saved.
//
// FIXME: This thing is racy. If a session is created at the same time as a
// `/keys/query` response is being processed, it could be saved
// without up-to-date sender data, but it might be saved too late for
// it to be picked up by `update_sender_data_from_device_changes`.
//
// FIXME: Come to that, what if this races against some other operation on the
// session, such as marking it as needing backup? It's all a bit terrifying.
// Note: it might be possible for this to race against session creation. If a
// new session is received at the same time as a `/keys/query` response is being
// processed, it could be saved without up-to-date sender data, but it might be
// saved too late for it to be picked up by
// `update_sender_data_from_device_changes`. However, this should be rare,
// since, in general, /sync responses which might create a new session
// are not processed at the same time as /keys/query responses (assuming
// that the application does not call `OlmMachine::receive_sync_changes`
// at the same time as `OlmMachine::mark_request_as_sent`).
self.update_sender_data_from_device_changes(&devices).await?;

// if this request is one of those we expected to be in flight, pass the
Expand Down

0 comments on commit 385e666

Please sign in to comment.