void AcsAgentClient::ReactorReadCallback()

in cpp/acs_agent_client.cc [323:345]


void AcsAgentClient::ReactorReadCallback(
    Response response, AcsAgentClientReactor::RpcStatus status) {
  if (status == AcsAgentClientReactor::RpcStatus::kRpcClosedByClient) {
    ABSL_VLOG(1) << "RPC is closed by client, don't restart the stream.";
    return;
  }
  if (status == AcsAgentClientReactor::RpcStatus::kRpcClosedByServer) {
    ABSL_VLOG(1) << "RPC is closed by server, restarting the stream.";
    // Wakes up RestartReactor() to restart the stream.
    absl::MutexLock lock(&reactor_mtx_);
    if (stream_state_ != ClientState::kShutdown) {
      // If the stream is being shutdown by client, ie. stream_state_ is
      // kShutdown, we should not restart the stream.
      stream_state_ = ClientState::kStreamTemporarilyDown;
    }
    return;
  }
  // Wake up ClientReadMessage().
  absl::MutexLock lock(&response_read_mtx_);
  msg_responses_.push(std::move(response));
  ABSL_VLOG(2) << "Producer called with response: "
               << absl::StrCat(msg_responses_.front());
}