fix(client): invalidate TX correlation after send failures

This commit is contained in:
Nils Andreas Svee committed 2026-09-15 13:03:36 +07:00
1 parent 188d6e5354
commit e861de5247
6 files changed
+66 -9

No files matched your search

+11 -4
View File
@@ -167,9 +167,9 @@ impl Client {
/// unrelated datagrams are ignored until the current attempt's absolute
/// deadline, so one attempt may consume several datagrams without
/// retransmitting. Silence or ignored traffic eventually produces
/// [`ClientError::OpenTimeout`]. A malformed or incompatible reply that is
/// recognized as coming from the connected peer is terminal; when HMAC is
/// configured, that recognition additionally requires authentication.
/// [`ClientError::OpenTimeout`]. A structurally recognizable malformed or
/// incompatible Open reply from the connected peer is terminal; when HMAC
/// is configured, that recognition additionally requires authentication.
///
/// When a trusted reply allocates a token but later negotiation or socket
/// preparation fails, the client sends a best-effort cleanup close and
@@ -524,11 +524,18 @@ impl Client {
.unwrap_or_else(Instant::now);
#[cfg(test)]
if fail_send {
runtime.invalidate_kernel_tx_correlation();
return Err(ClientError::Socket(io::Error::other(
"injected probe send failure",
)));
}
let bytes = socket.send(&prepared.bytes)?;
let bytes = match socket.send(&prepared.bytes) {
Ok(bytes) => bytes,
Err(error) => {
runtime.invalidate_kernel_tx_correlation();
return Err(ClientError::Socket(error));
}
};
#[cfg(not(test))]
let send_finished_at = Instant::now();
#[cfg(test)]