Skip to content

Commit 6991ce7

Browse files
committed
Fix BorrowMutError panic when invoking dispatch_grpc_call() inside on_grpc_call_response()
Signed-off-by: andytesti <[email protected]>
1 parent 89b48bd commit 6991ce7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dispatcher.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ impl Dispatcher {
453453
}
454454

455455
fn on_grpc_receive(&self, token_id: u32, response_size: usize) {
456-
if let Some(context_id) = self.grpc_callouts.borrow_mut().remove(&token_id) {
456+
let context_id = self.grpc_callouts.borrow_mut().remove(&token_id);
457+
if let Some(context_id) = context_id {
457458
if let Some(http_stream) = self.http_streams.borrow_mut().get_mut(&context_id) {
458459
self.active_id.set(context_id);
459460
hostcalls::set_effective_context(context_id).unwrap();

0 commit comments

Comments
 (0)