@@ -492,20 +492,24 @@ where
492492 } ,
493493 StateProj :: FollowingRedirect ( maybe_header) => match uri_from_header ( maybe_header) {
494494 Ok ( uri) => {
495+ trace ! ( "FollowingRedirect {:?}" , uri) ;
495496 * self . as_mut ( ) . project ( ) . current_url = uri;
496497 self . as_mut ( ) . project ( ) . state . set ( State :: New ) ;
497498 }
498499 Err ( e) => {
500+ trace ! ( "FollowingRedirect error {:?}" , e) ;
499501 self . as_mut ( ) . project ( ) . state . set ( State :: StreamClosed ) ;
500502 return Poll :: Ready ( Some ( Err ( e) ) ) ;
501503 }
502504 } ,
503505 StateProj :: Connected ( body) => match ready ! ( body. poll_data( cx) ) {
504506 Some ( Ok ( result) ) => {
507+ trace ! ( "Connected with result {:?}" , result) ;
505508 this. event_parser . process_bytes ( result) ?;
506509 continue ;
507510 }
508511 Some ( Err ( e) ) => {
512+ trace ! ( "Connected with error {:?}" , e) ;
509513 if self . props . reconnect_opts . reconnect {
510514 let duration = self . as_mut ( ) . backoff ( ) ;
511515 self . as_mut ( )
@@ -517,6 +521,7 @@ where
517521 if let Some ( cause) = e. source ( ) {
518522 if let Some ( downcast) = cause. downcast_ref :: < std:: io:: Error > ( ) {
519523 if let std:: io:: ErrorKind :: TimedOut = downcast. kind ( ) {
524+ trace ! ( "Timeout" ) ;
520525 return Poll :: Ready ( Some ( Err ( Error :: TimedOut ) ) ) ;
521526 }
522527 }
@@ -525,19 +530,23 @@ where
525530 }
526531 }
527532 None => {
533+ trace ! ( "Connected with None" ) ;
528534 let duration = self . as_mut ( ) . backoff ( ) ;
529535 self . as_mut ( )
530536 . project ( )
531537 . state
532538 . set ( State :: WaitingToReconnect ( delay ( duration, "retrying" ) ) ) ;
533539
534540 if self . event_parser . was_processing ( ) {
541+ trace ! ( "UnexpectedEof" ) ;
535542 return Poll :: Ready ( Some ( Err ( Error :: UnexpectedEof ) ) ) ;
536543 }
544+ trace ! ( "Eof" ) ;
537545 return Poll :: Ready ( Some ( Err ( Error :: Eof ) ) ) ;
538546 }
539547 } ,
540548 StateProj :: WaitingToReconnect ( delay) => {
549+ trace ! ( "WaitingToReconnect {:?}" , delay) ;
541550 ready ! ( delay. poll( cx) ) ;
542551 info ! ( "Reconnecting" ) ;
543552 self . as_mut ( ) . project ( ) . state . set ( State :: New ) ;
0 commit comments