| 355 | } |
| 356 | |
| 357 | void SubDone::Run() { |
| 358 | Controller* main_cntl = NULL; |
| 359 | const int rc = bthread_id_lock(_cid, (void**)&main_cntl); |
| 360 | if (rc != 0) { |
| 361 | // _cid must be valid because schan does not dtor before cancelling |
| 362 | // all sub calls. |
| 363 | LOG(ERROR) << "Fail to lock correlation_id=" |
| 364 | << _cid.value << ": " << berror(rc); |
| 365 | return; |
| 366 | } |
| 367 | Resource r; |
| 368 | r.response = _cntl._response; |
| 369 | r.sub_done = this; |
| 370 | if (!_owner->PushFree(r)) { |
| 371 | return; |
| 372 | } |
| 373 | const int saved_error = main_cntl->ErrorCode(); |
| 374 | |
| 375 | // NOTE: Copying gettable-but-settable fields which are generally set |
| 376 | // during the RPC to reflect details. |
| 377 | main_cntl->_remote_side = _cntl._remote_side; |
| 378 | // connection_type may be changed during CallMethod. |
| 379 | main_cntl->set_connection_type(_cntl.connection_type()); |
| 380 | main_cntl->response_attachment().swap(_cntl.response_attachment()); |
| 381 | |
| 382 | if (_cntl.Failed()) { |
| 383 | if (_cntl.ErrorCode() == ENODATA || _cntl.ErrorCode() == EHOSTDOWN) { |
| 384 | // LB could not find a server. |
| 385 | Socket::SetFailed(_peer_id); // trigger HC. |
| 386 | } |
| 387 | main_cntl->SetFailed(_cntl._error_text); |
| 388 | main_cntl->_error_code = _cntl._error_code; |
| 389 | } else { |
| 390 | if (_cntl._response != main_cntl->_response) { |
| 391 | main_cntl->_response->GetReflection()->Swap( |
| 392 | main_cntl->_response, _cntl._response); |
| 393 | } |
| 394 | } |
| 395 | const Controller::CompletionInfo info = { _cid, true }; |
| 396 | main_cntl->OnVersionedRPCReturned(info, false, saved_error); |
| 397 | } |
| 398 | |
| 399 | void Sender::Run() { |
| 400 | _finished = true; |
no test coverage detected