We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b47aec commit abfec5dCopy full SHA for abfec5d
src/dispatcher.rs
@@ -428,11 +428,17 @@ impl Dispatcher {
428
}
429
430
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");
+ let grpc_streams_ref = self.grpc_streams.borrow_mut();
+ let context_id_hash_slot = grpc_streams_ref
+ .get(&token_id);
+ let context_id = match context_id_hash_slot {
+ Some(id) => *id,
436
+ None => {
437
+ // TODO: change back to a panic once underlying issue is fixed.
438
+ trace!("on_grpc_receive_initial_metadata: invalid token_id");
439
+ return;
440
+ }
441
+ };
442
443
if let Some(http_stream) = self.http_streams.borrow_mut().get_mut(&context_id) {
444
self.active_id.set(context_id);
0 commit comments