MCPcopy Create free account
hub / github.com/apache/brpc / Echo

Method Echo

example/streaming_batch_echo_c++/server.cpp:62–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
81private:
82 void closeStreams() {

Callers 1

mainFunction · 0.45

Calls 2

StreamAcceptFunction · 0.85
SetFailedMethod · 0.45

Tested by

no test coverage detected