void ChannelManager::OnRpcDone()

in e2e-examples/gcs/sample/channel_manager.cc [74:88]


void ChannelManager::OnRpcDone(grpc::Channel* channel, grpc::Status status) {
  absl::MutexLock l(&lock_);
  for (auto& cs : channel_states_) {
    if (cs.channel.get() == channel) {
      cs.in_use_count -= 1;
      if (status.error_code() == grpc::StatusCode::CANCELLED ||
          status.error_code() == grpc::StatusCode::DEADLINE_EXCEEDED) {
        // Replace the unhealthy channel with the newly created one.
        cs.channel == channel_creator_();
        cs.in_use_count = 0;
      }
      break;
    }
  }
}