File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -428,11 +428,14 @@ impl Dispatcher {
428428 }
429429
430430 fn on_grpc_receive_initial_metadata ( & self , token_id : u32 , headers : u32 ) {
431- let context_id = * self
432- . grpc_streams
433- . borrow_mut ( )
434- . get ( & token_id)
435- . expect ( "invalid token_id" ) ;
431+ let context_id = match self . grpc_streams . borrow_mut ( ) . get ( & token_id) {
432+ Some ( id) => * id,
433+ None => {
434+ // TODO: change back to a panic once underlying issue is fixed.
435+ trace ! ( "on_grpc_receive_initial_metadata: invalid token_id" ) ;
436+ return ;
437+ }
438+ } ;
436439
437440 if let Some ( http_stream) = self . http_streams . borrow_mut ( ) . get_mut ( & context_id) {
438441 self . active_id . set ( context_id) ;
@@ -480,16 +483,20 @@ impl Dispatcher {
480483 root. on_grpc_stream_message ( token_id, response_size) ;
481484 }
482485 } else {
483- panic ! ( "invalid token_id" )
486+ // TODO: change back to a panic once underlying issue is fixed.
487+ trace ! ( "on_grpc_receive_initial_metadata: invalid token_id" ) ;
484488 }
485489 }
486490
487491 fn on_grpc_receive_trailing_metadata ( & self , token_id : u32 , trailers : u32 ) {
488- let context_id = * self
489- . grpc_streams
490- . borrow_mut ( )
491- . get ( & token_id)
492- . expect ( "invalid token_id" ) ;
492+ let context_id = match self . grpc_streams . borrow_mut ( ) . get ( & token_id) {
493+ Some ( id) => * id,
494+ None => {
495+ // TODO: change back to a panic once underlying issue is fixed.
496+ trace ! ( "on_grpc_receive_trailing_metadata: invalid token_id" ) ;
497+ return ;
498+ }
499+ } ;
493500
494501 if let Some ( http_stream) = self . http_streams . borrow_mut ( ) . get_mut ( & context_id) {
495502 self . active_id . set ( context_id) ;
You can’t perform that action at this time.
0 commit comments