Skip to content

Commit

Permalink
Grpc: Handle handler drops (usually client disconnect)
Browse files Browse the repository at this point in the history
When the client disconnects, its handler function is dropped. In this
case, we should not error, but log a warning and continue the loop.
Since we remove from the pending requests, no additional resources need
to be dropped
  • Loading branch information
TheCharlatan committed Dec 20, 2022
1 parent 43e8d78 commit ebcd5d9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/grpcd/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,10 +1352,9 @@ fn response_loop(
if let Some(sender) = pending_requests.remove(&id) {
if let Err(err) = sender.send(request) {
error!(
"Error encountered while sending response to Grpc server: {}",
"Error {} encountered while sending response to Grpc server handle: The client probably disconnected.",
err
);
break;
}
} else {
error!("id {} not found in pending grpc requests", id);
Expand All @@ -1371,7 +1370,6 @@ fn response_loop(
}
};
}
Ok(())
})
}

Expand Down

0 comments on commit ebcd5d9

Please sign in to comment.