File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
leaf/src/proxy/mptp/mptp_conn Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " leaf-cli"
3- version = " 0.14.0 "
3+ version = " 0.14.1 "
44authors = [" eycorsican <eric.y.corsican@gmail.com>" ]
55edition = " 2021"
66
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments