in e2e-examples/gcs/benchmark/channel_policy.cc [108:123]
void ReportResult(void* handle, const grpc::Status& status,
const grpc::ClientContext& context,
absl::Duration elapsed_time, int64_t bytes) override {
if (status.error_code() == grpc::StatusCode::CANCELLED ||
status.error_code() == grpc::StatusCode::DEADLINE_EXCEEDED) {
auto i = std::find_if(channels_.begin(), channels_.end(),
[handle](std::shared_ptr<grpc::Channel> val) {
return (void*)val.get() == handle;
});
if (i != channels_.end()) {
std::cout << "Evict the channel (peer=" << context.peer()
<< ") due to error:" << status.error_code() << std::endl;
*i = channel_creator_();
}
}
}