@@ -582,7 +582,9 @@ impl SessionInner {
582
582
} ) ) ;
583
583
self . post_frame ( detach. into ( ) ) ;
584
584
585
- self . links . remove ( token) ;
585
+ if self . links . contains ( token) {
586
+ self . links . remove ( token) ;
587
+ }
586
588
}
587
589
588
590
pub ( crate ) fn get_sender_link_by_local_handle ( & self , hnd : Handle ) -> Option < & SenderLink > {
@@ -723,7 +725,9 @@ impl SessionInner {
723
725
} ) ) ;
724
726
self . post_frame ( detach. into ( ) ) ;
725
727
let _ = tx. send ( Ok ( ( ) ) ) ;
726
- let _ = self . links . remove ( id as usize ) ;
728
+ if self . links . contains ( id as usize ) {
729
+ let _ = self . links . remove ( id as usize ) ;
730
+ }
727
731
}
728
732
ReceiverLinkState :: Established ( receiver_link) => {
729
733
let receiver_link = receiver_link. clone ( ) ;
@@ -742,7 +746,9 @@ impl SessionInner {
742
746
}
743
747
ReceiverLinkState :: Closing ( _) => {
744
748
let _ = tx. send ( Ok ( ( ) ) ) ;
745
- let _ = self . links . remove ( id as usize ) ;
749
+ if self . links . contains ( id as usize ) {
750
+ let _ = self . links . remove ( id as usize ) ;
751
+ }
746
752
log:: error!(
747
753
"{}: Unexpected receiver link state: closing - {}" ,
748
754
self . tag( ) ,
@@ -1089,7 +1095,9 @@ impl SessionInner {
1089
1095
} ;
1090
1096
1091
1097
if remove {
1092
- self . links . remove ( idx) ;
1098
+ if self . links . contains ( idx) {
1099
+ self . links . remove ( idx) ;
1100
+ }
1093
1101
self . remote_handles . remove ( & handle) ;
1094
1102
}
1095
1103
action
0 commit comments