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 @@ -501,14 +501,19 @@ where
501501 type Output = crate :: Result < ( ) > ;
502502
503503 fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
504- match ready ! ( Pin :: new( & mut self . inner. as_mut( ) . unwrap( ) . conn) . poll( cx) ) {
505- Ok ( proto:: Dispatched :: Shutdown ) => Poll :: Ready ( Ok ( ( ) ) ) ,
506- Ok ( proto:: Dispatched :: Upgrade ( pending) ) => {
507- let ( io, buf, _) = self . inner . take ( ) . unwrap ( ) . conn . into_inner ( ) ;
508- pending. fulfill ( Upgraded :: new ( io, buf) ) ;
509- Poll :: Ready ( Ok ( ( ) ) )
504+ if let Some ( conn) = self . inner . as_mut ( ) {
505+ match ready ! ( Pin :: new( & mut conn. conn) . poll( cx) ) {
506+ Ok ( proto:: Dispatched :: Shutdown ) => Poll :: Ready ( Ok ( ( ) ) ) ,
507+ Ok ( proto:: Dispatched :: Upgrade ( pending) ) => {
508+ let ( io, buf, _) = self . inner . take ( ) . unwrap ( ) . conn . into_inner ( ) ;
509+ pending. fulfill ( Upgraded :: new ( io, buf) ) ;
510+ Poll :: Ready ( Ok ( ( ) ) )
511+ }
512+ Err ( e) => Poll :: Ready ( Err ( e) ) ,
510513 }
511- Err ( e) => Poll :: Ready ( Err ( e) ) ,
514+ } else {
515+ // inner is `None`, meaning the connection was upgraded, thus it's `Poll::Ready(Ok(()))`
516+ Poll :: Ready ( Ok ( ( ) ) )
512517 }
513518 }
514519}
You can’t perform that action at this time.
0 commit comments