Skip to content

Commit

Permalink
Merge pull request #139 from arkedge/fix-serialport-leak
Browse files Browse the repository at this point in the history
Close all streams even if any stream closed normally
  • Loading branch information
KOBA789 authored Jan 29, 2025
2 parents d1ee93d + 198c4b3 commit b271d33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kble-serialport/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ async fn handle_ws(ws: WebSocket, serialport: SerialStream) {
let chunk = chunk?;
tx.write_all(&chunk).await?;
}
tx.flush().await?;
anyhow::Ok(())
};
futures::future::try_join(rx_fut, tx_fut).await.ok();
tokio::pin!(rx_fut, tx_fut);
futures::future::try_select(rx_fut, tx_fut).await.ok();
}

0 comments on commit b271d33

Please sign in to comment.