mirror of
https://github.com/block/buzz.git
synced 2026-10-28 21:11:48 +00:00
fix(acp): preserve connected response errors
Only suppress response writes after an observed peer disconnect; keep other endpoint I/O failures visible. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@users.noreply.github.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
@@ -118,13 +118,13 @@ where
|
||||
let (cancel_tx, cancel_rx) = oneshot::channel();
|
||||
let execution = execute(request, cancel_rx);
|
||||
tokio::pin!(execution);
|
||||
let result = tokio::select! {
|
||||
result = &mut execution => result,
|
||||
let (result, disconnected) = tokio::select! {
|
||||
result = &mut execution => (result, false),
|
||||
read = stream.read_u8() => {
|
||||
let _ = cancel_tx.send(());
|
||||
let result = execution.await;
|
||||
tracing::debug!(?read, "isolated-turn client disconnected");
|
||||
result
|
||||
(result, true)
|
||||
}
|
||||
};
|
||||
let result = match result {
|
||||
@@ -136,9 +136,10 @@ where
|
||||
},
|
||||
};
|
||||
// Execution cleanup above is authoritative even when the peer is gone.
|
||||
match write_frame(&mut stream, &result).await {
|
||||
Err(error) if error.downcast_ref::<std::io::Error>().is_some() => Ok(()),
|
||||
other => other,
|
||||
if disconnected {
|
||||
Ok(())
|
||||
} else {
|
||||
write_frame(&mut stream, &result).await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user