| 35 | EchoServiceImpl() {} |
| 36 | ~EchoServiceImpl() {} |
| 37 | void Echo(google::protobuf::RpcController* cntl_base, |
| 38 | const example::EchoRequest* request, |
| 39 | example::EchoResponse* response, |
| 40 | google::protobuf::Closure* done) { |
| 41 | brpc::ClosureGuard done_guard(done); |
| 42 | brpc::Controller* cntl = |
| 43 | static_cast<brpc::Controller*>(cntl_base); |
| 44 | |
| 45 | // Echo request and its attachment |
| 46 | response->set_value(request->value()); |
| 47 | if (FLAGS_echo_attachment) { |
| 48 | cntl->response_attachment().append(cntl->request_attachment()); |
| 49 | } |
| 50 | } |
| 51 | }; |
| 52 | |
| 53 | int main(int argc, char* argv[]) { |