void MyLeafAsyncClient::sync_do_leaf(apache::thrift::RpcOptions& rpcOptions) { apache::thrift::ClientReceiveState _returnState; std::unique_ptr<apache::thrift::RequestCallback> callback8(new apache::thrift::ClientSyncCallback(&_returnState, getChannel()->getEventBase(), false)); do_leaf(rpcOptions, std::move(callback8)); getChannel()->getEventBase()->loopForever(); if (!_returnState.buf()) { assert(_returnState.exception()); std::rethrow_exception(_returnState.exception()); } recv_do_leaf(_returnState); }
void MyServiceAsyncClient::sync_putDataById(apache::thrift::RpcOptions& rpcOptions, int64_t id, const std::string& data) { apache::thrift::ClientReceiveState _returnState; std::unique_ptr<apache::thrift::RequestCallback> callback8(new apache::thrift::ClientSyncCallback(&_returnState, getChannel()->getEventBase(), false)); putDataById(rpcOptions, std::move(callback8), id, data); getChannel()->getEventBase()->loopForever(); SCOPE_EXIT { if (_returnState.header() && !_returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(_returnState.header()->releaseHeaders()); } }; if (!_returnState.buf()) { assert(_returnState.exception()); std::rethrow_exception(_returnState.exception()); } recv_putDataById(_returnState); }