| 401 | } |
| 402 | |
| 403 | void OutboundCall::SetTimedOut(Phase phase) { |
| 404 | static const char* kErrMsgNegotiation = |
| 405 | "connection negotiation to $1 for RPC $0 timed out after $2 ($3)"; |
| 406 | static const char* kErrMsgCall = "$0 RPC to $1 timed out after $2 ($3)"; |
| 407 | DCHECK(phase == Phase::CONNECTION_NEGOTIATION || phase == Phase::REMOTE_CALL); |
| 408 | |
| 409 | // We have to fetch timeout outside the lock to avoid a lock |
| 410 | // order inversion between this class and RpcController. |
| 411 | const MonoDelta timeout = controller_->timeout(); |
| 412 | { |
| 413 | std::lock_guard<simple_spinlock> l(lock_); |
| 414 | status_ = Status::TimedOut( |
| 415 | Substitute((phase == Phase::REMOTE_CALL) ? kErrMsgCall : kErrMsgNegotiation, |
| 416 | remote_method_.method_name(), |
| 417 | conn_id_.remote().ToString(), |
| 418 | timeout.ToString(), |
| 419 | StateName(state_))); |
| 420 | set_state_unlocked((phase == Phase::REMOTE_CALL) ? TIMED_OUT : NEGOTIATION_TIMED_OUT); |
| 421 | } |
| 422 | CallCallback(); |
| 423 | } |
| 424 | |
| 425 | void OutboundCall::SetCancelled() { |
| 426 | DCHECK(!IsFinished()); |
no test coverage detected