Return error on session unavailable in handle_subsession_packet

Replace .session().ok() with proper error handling to fail fast when
session is Closed or Processing after state machine processing.

Previously, the code silently continued with outer_key = None, which
could cause protocol errors downstream.

Closes: nym-8de0
This commit is contained in:
durch
2025-12-16 18:11:52 +01:00
committed by Jędrzej Stuczyński
parent 4e8411a728
commit d09e7a296d
+2 -2
View File
@@ -453,8 +453,8 @@ impl LpConnectionHandler {
// Get outer key before releasing borrow
let outer_key = state_machine
.session()
.ok()
.and_then(|s| s.outer_aead_key());
.map_err(|e| GatewayError::LpProtocolError(format!("Session unavailable after processing: {}", e)))?
.outer_aead_key();
drop(state_entry);
match action {