| 32 | DEFINE_int32(max_retry, 3, "Max retries(not including the first RPC)"); |
| 33 | |
| 34 | void HandleEchoResponse( |
| 35 | brpc::Controller* cntl, |
| 36 | example::EchoResponse* response) { |
| 37 | // std::unique_ptr makes sure cntl/response will be deleted before returning. |
| 38 | std::unique_ptr<brpc::Controller> cntl_guard(cntl); |
| 39 | std::unique_ptr<example::EchoResponse> response_guard(response); |
| 40 | |
| 41 | if (cntl->Failed()) { |
| 42 | LOG(WARNING) << "Fail to send EchoRequest, " << cntl->ErrorText(); |
| 43 | return; |
| 44 | } |
| 45 | LOG(INFO) << "Received response from " << cntl->remote_side() |
| 46 | << ": " << response->message() << " (attached=" |
| 47 | << cntl->response_attachment() << ")" |
| 48 | << " latency=" << cntl->latency_us() << "us"; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | int main(int argc, char* argv[]) { |
nothing calls this directly
no test coverage detected