Skip to content

Commit 7474076

Browse files
committed
v0.14.1
1 parent 0bd92d4 commit 7474076

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

leaf-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "leaf-cli"
3-
version = "0.14.0"
3+
version = "0.14.1"
44
authors = ["eycorsican <eric.y.corsican@gmail.com>"]
55
edition = "2021"
66

leaf/src/proxy/mptp/mptp_conn/stream.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,17 @@ impl<S: AsyncRead + AsyncWrite + Unpin> AsyncRead for MptpStream<S> {
210210

211211
// Check if ALL are closed
212212
let all_closed = this.subs.iter().all(|s| s.closed);
213-
if all_closed && !this.subs.is_empty() {
214-
warn!("All sub-connections closed/failed without MTYP_FIN");
215-
return Poll::Ready(Err(io::Error::new(
216-
io::ErrorKind::ConnectionAborted,
217-
"All sub-connections failed",
218-
)));
213+
if all_closed && !this.subs.is_empty() && this.new_subs_rx.is_none() {
214+
if !this.closed {
215+
warn!("All sub-connections closed/failed without MTYP_FIN");
216+
return Poll::Ready(Err(io::Error::new(
217+
io::ErrorKind::ConnectionAborted,
218+
"All sub-connections failed",
219+
)));
220+
} else {
221+
// We received FIN and all subs are closed, that's fine
222+
return Poll::Ready(Ok(()));
223+
}
219224
}
220225

221226
// Second pass: Process frames from buffer
@@ -629,7 +634,9 @@ mod tests {
629634
tokio::spawn(async move {
630635
let mut buf = [0u8; 1024];
631636
while let Ok(n) = s1.read(&mut buf).await {
632-
if n == 0 { break; }
637+
if n == 0 {
638+
break;
639+
}
633640
}
634641
});
635642

0 commit comments

Comments
 (0)