Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ pub(crate) struct SessionBatchOutcome {
had_failure: bool,
}

#[derive(Clone, Copy, Debug, Default)]
struct MigrationDecryptOutcome {
decrypted: bool,
duplicate: bool,
dispatched: bool,
skdm_only: bool,
plaintext_failed: bool,
/// Outcome of a PN→LID migration retry decrypt. On `Decrypted` the plaintext
/// has already been pushed onto the caller's deferred-handling buffer (it runs
/// after the session lock is released), so no dispatch flags travel back here.
#[derive(Clone, Copy, Debug)]
enum MigrationDecryptResult {
/// Decrypted; plaintext buffered for post-lock handling.
Decrypted,
/// Server redelivered an already-processed message.
Duplicate,
/// Migration didn't apply or still failed; caller sends a retry receipt.
NotDecrypted,
}

#[derive(Clone, Copy, Debug, Default)]
Expand All @@ -95,6 +99,14 @@ pub(crate) struct PlaintextHandleOutcome {
skdm_only: bool,
}

/// A decrypted session plaintext buffered during the locked decrypt loop and
/// handled after the per-sender session lock is released.
struct DeferredPlaintext {
enc_type: &'static str,
plaintext: Vec<u8>,
padding_version: u8,
}

fn should_process_skmsg_after_session(
session_payloads_empty: bool,
session_outcome: SessionBatchOutcome,
Expand Down
Loading
Loading