| 380 | } |
| 381 | |
| 382 | void Connection::HandleOutboundCallTimeout(CallAwaitingResponse *car) { |
| 383 | DCHECK(reactor_thread_->IsCurrentThread()); |
| 384 | if (!car->call) { |
| 385 | // The RPC may have been cancelled before the timeout was hit. |
| 386 | return; |
| 387 | } |
| 388 | // The timeout timer is stopped by the car destructor exiting Connection::HandleCallResponse() |
| 389 | DCHECK(!car->call->IsFinished()); |
| 390 | |
| 391 | // Mark the call object as failed. |
| 392 | car->call->SetTimedOut(negotiation_complete_ ? Phase::REMOTE_CALL |
| 393 | : Phase::CONNECTION_NEGOTIATION); |
| 394 | |
| 395 | // Test cancellation when 'car->call' is in 'TIMED_OUT' state |
| 396 | MaybeInjectCancellation(car->call); |
| 397 | |
| 398 | // Drop the reference to the call. If the original caller has moved on after |
| 399 | // seeing the timeout, we no longer need to hold onto the allocated memory |
| 400 | // from the request. |
| 401 | car->call.reset(); |
| 402 | |
| 403 | // We still leave the CallAwaitingResponse in the map -- this is because we may still |
| 404 | // receive a response from the server, and we don't want a spurious log message |
| 405 | // when we do finally receive the response. The fact that CallAwaitingResponse::call |
| 406 | // is a NULL pointer indicates to the response processing code that the call |
| 407 | // already timed out. |
| 408 | } |
| 409 | |
| 410 | void Connection::CancelOutboundCall(const shared_ptr<OutboundCall> &call) { |
| 411 | CallAwaitingResponse* car = FindPtrOrNull(awaiting_response_, call->call_id()); |
no test coverage detected