Commit 23afa52c authored by wangxuefeng's avatar wangxuefeng

Fix white space issue.

parent c85ce64a
......@@ -63,17 +63,17 @@ int main(int argc, char* argv[]) {
brpc::ThriftBinaryMessage response;
brpc::Controller cntl;
// Thrift Req
example::EchoRequest thrift_request;
thrift_request.data = "hello";
std::string function_name = "Echo";
int32_t seqid = 0;
if (!serilize_thrift_server_message<example::EchoService_Echo_pargs>(thrift_request, function_name, seqid, &request)) {
LOG(ERROR) << "serilize_thrift_server_message error!";
continue;
}
// Thrift Req
example::EchoRequest thrift_request;
thrift_request.data = "hello";
std::string function_name = "Echo";
int32_t seqid = 0;
if (!serilize_thrift_server_message<example::EchoService_Echo_pargs>(thrift_request, function_name, seqid, &request)) {
LOG(ERROR) << "serilize_thrift_server_message error!";
continue;
}
cntl.set_log_id(log_id ++); // set by user
......@@ -88,20 +88,20 @@ int main(int argc, char* argv[]) {
g_latency_recorder << cntl.latency_us();
}
example::EchoResponse thrift_response;
if (!deserilize_thrift_server_message<example::EchoService_Echo_presult>(response, &function_name, &seqid, &thrift_response)) {
LOG(ERROR) << "deserilize_thrift_server_message error!";
continue;
}
example::EchoResponse thrift_response;
if (!deserilize_thrift_server_message<example::EchoService_Echo_presult>(response, &function_name, &seqid, &thrift_response)) {
LOG(ERROR) << "deserilize_thrift_server_message error!";
continue;
}
LOG(INFO) << "Thrift function_name: " << function_name
<< "Thrift Res data: " << thrift_response.data;
LOG(INFO) << "Thrift function_name: " << function_name
<< "Thrift Res data: " << thrift_response.data;
LOG_EVERY_SECOND(INFO)
<< "Sending thrift requests at qps=" << g_latency_recorder.qps(1)
<< " latency=" << g_latency_recorder.latency(1);
sleep(1);
sleep(1);
}
LOG(INFO) << "EchoClient is going to quit";
......
......@@ -52,30 +52,30 @@ public:
}
example::EchoRequest thrift_request;
std::string function_name;
int32_t seqid;
//
if (!serilize_thrift_client_message<example::EchoService_Echo_args>(request,
&thrift_request, &function_name, &seqid)) {
cntl->CloseConnection("Close connection due to serilize thrift client reuqest error!");
LOG(ERROR) << "serilize thrift client reuqest error!";
std::string function_name;
int32_t seqid;
//
if (!serilize_thrift_client_message<example::EchoService_Echo_args>(request,
&thrift_request, &function_name, &seqid)) {
cntl->CloseConnection("Close connection due to serilize thrift client reuqest error!");
LOG(ERROR) << "serilize thrift client reuqest error!";
return;
}
}
LOG(INFO) << "RPC funcname: " << function_name
<< "thrift request data: " << thrift_request.data;
LOG(INFO) << "RPC funcname: " << function_name
<< "thrift request data: " << thrift_request.data;
example::EchoResponse thrift_response;
// Proc RPC , just append a simple string
example::EchoResponse thrift_response;
// Proc RPC , just append a simple string
thrift_response.data = thrift_request.data + " world";
if (!deserilize_thrift_client_message<example::EchoService_Echo_result>(thrift_response,
function_name, seqid, response)) {
cntl->CloseConnection("Close connection due to deserilize thrift client response error!");
LOG(ERROR) << "deserilize thrift client response error!";
if (!deserilize_thrift_client_message<example::EchoService_Echo_result>(thrift_response,
function_name, seqid, response)) {
cntl->CloseConnection("Close connection due to deserilize thrift client response error!");
LOG(ERROR) << "deserilize thrift client response error!";
return;
}
}
LOG(INFO) << "success process thrift request in brpc";
}
......
......@@ -32,11 +32,11 @@ int main(int argc, char **argv) {
google::ParseCommandLineFlags(&argc, &argv, true);
boost::shared_ptr<apache::thrift::transport::TSocket> socket(
new apache::thrift::transport::TSocket(FLAGS_server, FLAGS_port));
new apache::thrift::transport::TSocket(FLAGS_server, FLAGS_port));
boost::shared_ptr<apache::thrift::transport::TTransport> transport(
new apache::thrift::transport::TFramedTransport(socket));
new apache::thrift::transport::TFramedTransport(socket));
boost::shared_ptr<apache::thrift::protocol::TProtocol> protocol(
new apache::thrift::protocol::TBinaryProtocol(transport));
new apache::thrift::protocol::TBinaryProtocol(transport));
example::EchoServiceClient client(protocol);
transport->open();
......
......@@ -31,13 +31,13 @@ DEFINE_int32(port, 8019, "Port of server");
class EchoServiceHandler : virtual public example::EchoServiceIf {
public:
EchoServiceHandler() {}
EchoServiceHandler() {}
void Echo(example::EchoResponse& res, const example::EchoRequest& req) {
void Echo(example::EchoResponse& res, const example::EchoRequest& req) {
// Process request, just attach a simple string.
res.data = req.data + " world";
return;
}
res.data = req.data + " world";
return;
}
};
......@@ -52,7 +52,7 @@ int main(int argc, char *argv[]) {
apache::thrift::concurrency::PosixThreadFactory::NORMAL, 1, false));
boost::shared_ptr<apache::thrift::server::TProcessor> processor(
new example::EchoServiceProcessor(handler));
new example::EchoServiceProcessor(handler));
boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> protocol_factory(
new apache::thrift::protocol::TBinaryProtocolFactory());
boost::shared_ptr<apache::thrift::transport::TTransportFactory> transport_factory(
......@@ -68,5 +68,5 @@ int main(int argc, char *argv[]) {
protocol_factory, FLAGS_port, thread_mgr);
server.serve();
return 0;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment