| 60 | closeStreams(); |
| 61 | }; |
| 62 | virtual void Echo(google::protobuf::RpcController* controller, |
| 63 | const example::EchoRequest* /*request*/, |
| 64 | example::EchoResponse* response, |
| 65 | google::protobuf::Closure* done) { |
| 66 | // This object helps you to call done->Run() in RAII style. If you need |
| 67 | // to process the request asynchronously, pass done_guard.release(). |
| 68 | brpc::ClosureGuard done_guard(done); |
| 69 | closeStreams(); |
| 70 | brpc::Controller* cntl = |
| 71 | static_cast<brpc::Controller*>(controller); |
| 72 | brpc::StreamOptions stream_options; |
| 73 | stream_options.handler = &_receiver; |
| 74 | if (brpc::StreamAccept(_sds, *cntl, &stream_options) != 0) { |
| 75 | cntl->SetFailed("Fail to accept stream"); |
| 76 | return; |
| 77 | } |
| 78 | response->set_message("Accepted stream"); |
| 79 | } |
| 80 | |
| 81 | private: |
| 82 | void closeStreams() { |
no test coverage detected