File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ use libp2p_core::muxing::{StreamMuxer, StreamMuxerEvent};
3131use libp2p_core:: upgrade:: { InboundUpgrade , OutboundUpgrade , UpgradeInfo } ;
3232use parking_lot:: Mutex ;
3333use std:: {
34- fmt, io, iter,
34+ fmt, io, iter, mem ,
3535 pin:: Pin ,
3636 task:: { Context , Poll } ,
3737} ;
@@ -179,16 +179,21 @@ where
179179
180180 fn poll_close ( & self , c : & mut Context < ' _ > ) -> Poll < YamuxResult < ( ) > > {
181181 let mut inner = self . 0 . lock ( ) ;
182- if let std:: task:: Poll :: Ready ( x) = Pin :: new ( & mut inner. control ) . poll_close ( c) {
183- return Poll :: Ready ( x. map_err ( YamuxError ) ) ;
182+
183+ if let Poll :: Ready ( ( ) ) = Pin :: new ( & mut inner. control )
184+ . poll_close ( c)
185+ . map_err ( YamuxError ) ?
186+ {
187+ return Poll :: Ready ( Ok ( ( ) ) ) ;
184188 }
185- while let std :: task :: Poll :: Ready ( x ) = inner . incoming . poll_next_unpin ( c ) {
186- match x {
187- Some ( Ok ( _ ) ) => { } // drop inbound stream
188- Some ( Err ( e ) ) => return Poll :: Ready ( Err ( e ) ) ,
189+
190+ while let Poll :: Ready ( maybe_inbound_stream ) = inner . incoming . poll_next_unpin ( c ) ? {
191+ match maybe_inbound_stream {
192+ Some ( inbound_stream ) => mem :: drop ( inbound_stream ) ,
189193 None => return Poll :: Ready ( Ok ( ( ) ) ) ,
190194 }
191195 }
196+
192197 Poll :: Pending
193198 }
194199}
You can’t perform that action at this time.
0 commit comments