File tree 1 file changed +12
-7
lines changed
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -501,14 +501,19 @@ where
501
501
type Output = crate :: Result < ( ) > ;
502
502
503
503
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) ) ,
510
513
}
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 ( ( ) ) )
512
517
}
513
518
}
514
519
}
You can’t perform that action at this time.
0 commit comments