Commit e018977c authored by wangxuefeng's avatar wangxuefeng

Fix merge issue

parent 56aa6d4c
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <butil/thrift_utils.h> #include <butil/thrift_utils.h>
#include <butil/strings/string_piece.h> #include <butil/strings/string_piece.h>
#include <brpc/channel.h> #include <brpc/channel.h>
#include <brpc/thrift_binary_message.h> #include <brpc/thrift_framed_message.h>
#include <bvar/bvar.h> #include <bvar/bvar.h>
#include <thrift/transport/TBufferTransports.h> #include <thrift/transport/TBufferTransports.h>
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
// Authors: wangxuefeng (wangxuefeng@didichuxing.com) // Authors: wangxuefeng (wangxuefeng@didichuxing.com)
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
#include <google/protobuf/descriptor.h> // MethodDescriptor #include <google/protobuf/descriptor.h> // MethodDescriptor
#include <google/protobuf/message.h> // Message #include <google/protobuf/message.h> // Message
#include <gflags/gflags.h> #include <gflags/gflags.h>
...@@ -613,3 +615,5 @@ void PackThriftFramedRequest( ...@@ -613,3 +615,5 @@ void PackThriftFramedRequest(
} // namespace policy } // namespace policy
} // namespace brpc } // namespace brpc
#endif
...@@ -14,11 +14,13 @@ ...@@ -14,11 +14,13 @@
// Authors: wangxuefeng (wangxuefeng@didichuxing.com) // Authors: wangxuefeng (wangxuefeng@didichuxing.com)
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
#ifndef BRPC_POLICY_THRIFT_PROTOCOL_H #ifndef BRPC_POLICY_THRIFT_PROTOCOL_H
#define BRPC_POLICY_THRIFT_PROTOCOL_H #define BRPC_POLICY_THRIFT_PROTOCOL_H
#include "brpc/protocol.h" #include "brpc/protocol.h"
#include "brpc/thrift_binary_message.h" #include "brpc/thrift_framed_message.h"
namespace brpc { namespace brpc {
namespace policy { namespace policy {
...@@ -52,3 +54,4 @@ bool VerifyThriftFramedRequest(const InputMessageBase *msg); ...@@ -52,3 +54,4 @@ bool VerifyThriftFramedRequest(const InputMessageBase *msg);
#endif // BRPC_POLICY_THRIFT_PROTOCOL_H #endif // BRPC_POLICY_THRIFT_PROTOCOL_H
#endif
...@@ -317,9 +317,11 @@ void* Server::UpdateDerivedVars(void* arg) { ...@@ -317,9 +317,11 @@ void* Server::UpdateDerivedVars(void* arg) {
server->options().nshead_service->Expose(prefix); server->options().nshead_service->Expose(prefix);
} }
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
if (server->options().thrift_service) { if (server->options().thrift_service) {
server->options().thrift_service->Expose(prefix); server->options().thrift_service->Expose(prefix);
} }
#endif
int64_t last_time = butil::gettimeofday_us(); int64_t last_time = butil::gettimeofday_us();
int consecutive_nosleep = 0; int consecutive_nosleep = 0;
...@@ -403,8 +405,10 @@ Server::~Server() { ...@@ -403,8 +405,10 @@ Server::~Server() {
delete _options.nshead_service; delete _options.nshead_service;
_options.nshead_service = NULL; _options.nshead_service = NULL;
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
delete _options.thrift_service; delete _options.thrift_service;
_options.thrift_service = NULL; _options.thrift_service = NULL;
#endif
delete _options.http_master_service; delete _options.http_master_service;
_options.http_master_service = NULL; _options.http_master_service = NULL;
...@@ -1545,12 +1549,15 @@ void Server::GenerateVersionIfNeeded() { ...@@ -1545,12 +1549,15 @@ void Server::GenerateVersionIfNeeded() {
} }
_version.append(butil::class_name_str(*_options.nshead_service)); _version.append(butil::class_name_str(*_options.nshead_service));
} }
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
if (_options.thrift_service) { if (_options.thrift_service) {
if (!_version.empty()) { if (!_version.empty()) {
_version.push_back('+'); _version.push_back('+');
} }
_version.append(butil::class_name_str(*_options.thrift_service)); _version.append(butil::class_name_str(*_options.thrift_service));
} }
#endif
if (_options.rtmp_service) { if (_options.rtmp_service) {
if (!_version.empty()) { if (!_version.empty()) {
......
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
// Authors: wangxuefeng (wangxuefeng@didichuxing.com) // Authors: wangxuefeng (wangxuefeng@didichuxing.com)
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "brpc/thrift_binary_message.h" #include "brpc/thrift_framed_message.h"
#include <algorithm> #include <algorithm>
#include "butil/logging.h" #include "butil/logging.h"
...@@ -39,7 +41,7 @@ void protobuf_AssignDesc_baidu_2frpc_2fthrift_binary_5fmessage_2eproto() { ...@@ -39,7 +41,7 @@ void protobuf_AssignDesc_baidu_2frpc_2fthrift_binary_5fmessage_2eproto() {
protobuf_AddDesc_baidu_2frpc_2fthrift_binary_5fmessage_2eproto(); protobuf_AddDesc_baidu_2frpc_2fthrift_binary_5fmessage_2eproto();
const ::google::protobuf::FileDescriptor* file = const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"baidu/rpc/thrift_binary_message.proto"); "baidu/rpc/thrift_framed_message.proto");
GOOGLE_CHECK(file != NULL); GOOGLE_CHECK(file != NULL);
ThriftFramedMessage_descriptor_ = file->message_type(0); ThriftFramedMessage_descriptor_ = file->message_type(0);
} }
...@@ -73,10 +75,10 @@ void protobuf_AddDesc_baidu_2frpc_2fthrift_binary_5fmessage_2eproto_impl() { ...@@ -73,10 +75,10 @@ void protobuf_AddDesc_baidu_2frpc_2fthrift_binary_5fmessage_2eproto_impl() {
::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); ::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
#endif #endif
::google::protobuf::DescriptorPool::InternalAddGeneratedFile( ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\033thrift_binary_message.proto\022\004brpc\"\025\n\023T" "\n\033thrift_framed_message.proto\022\004brpc\"\025\n\023T"
"hriftBinaryMessage", 58); "hriftBinaryMessage", 58);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"thrift_binary_message.proto", &protobuf_RegisterTypes); "thrift_framed_message.proto", &protobuf_RegisterTypes);
ThriftFramedMessage::default_instance_ = new ThriftFramedMessage(); ThriftFramedMessage::default_instance_ = new ThriftFramedMessage();
ThriftFramedMessage::default_instance_->InitAsDefaultInstance(); ThriftFramedMessage::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_baidu_2frpc_2fthrift_binary_5fmessage_2eproto); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_baidu_2frpc_2fthrift_binary_5fmessage_2eproto);
...@@ -235,3 +237,5 @@ void ThriftFramedMessage::Swap(ThriftFramedMessage* other) { ...@@ -235,3 +237,5 @@ void ThriftFramedMessage::Swap(ThriftFramedMessage* other) {
} }
} // namespace brpc } // namespace brpc
#endif
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
// Authors: wangxuefeng (wangxuefeng@didichuxing.com) // Authors: wangxuefeng (wangxuefeng@didichuxing.com)
#ifndef BRPC_THRIFT_BINARY_MESSAGE_H #ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
#define BRPC_THRIFT_BINARY_MESSAGE_H
#ifndef BRPC_THRIFT_FRAMED_MESSAGE_H
#define BRPC_THRIFT_FRAMED_MESSAGE_H
#include <functional> #include <functional>
#include <string> #include <string>
...@@ -227,4 +229,6 @@ private: ...@@ -227,4 +229,6 @@ private:
} // namespace brpc } // namespace brpc
#endif // BRPC_THRIFT_BINARY_MESSAGE_H #endif // BRPC_THRIFT_FRAMED_MESSAGE_H
#endif
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
// limitations under the License. // limitations under the License.
// Authors: wangxuefeng (wangxuefeng@didichuxing.com) // Authors: wangxuefeng (wangxuefeng@didichuxing.com)
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
#include "butil/class_name.h" #include "butil/class_name.h"
#include "brpc/thrift_service.h" #include "brpc/thrift_service.h"
...@@ -59,3 +60,5 @@ void ThriftFramedService::Expose(const butil::StringPiece& prefix) { ...@@ -59,3 +60,5 @@ void ThriftFramedService::Expose(const butil::StringPiece& prefix) {
} }
} // namespace brpc } // namespace brpc
#endif
...@@ -14,11 +14,13 @@ ...@@ -14,11 +14,13 @@
// Authors: wangxuefeng (wangxuefeng@didichuxing.com) // Authors: wangxuefeng (wangxuefeng@didichuxing.com)
#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
#ifndef BRPC_THRIFT_SERVICE_H #ifndef BRPC_THRIFT_SERVICE_H
#define BRPC_THRIFT_SERVICE_H #define BRPC_THRIFT_SERVICE_H
#include "brpc/controller.h" // Controller #include "brpc/controller.h" // Controller
#include "brpc/thrift_binary_message.h" // ThriftFramedMessage #include "brpc/thrift_framed_message.h" // ThriftFramedMessage
#include "brpc/describable.h" #include "brpc/describable.h"
...@@ -127,3 +129,6 @@ private: ...@@ -127,3 +129,6 @@ private:
#endif // BRPC_THRIFT_SERVICE_H #endif // BRPC_THRIFT_SERVICE_H
#endif
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <brpc/channel.h> #include <brpc/channel.h>
#include <brpc/thrift_binary_message.h> #include <brpc/thrift_framed_message.h>
#include <thrift/TDispatchProcessor.h> #include <thrift/TDispatchProcessor.h>
#include <thrift/transport/TBufferTransports.h> #include <thrift/transport/TBufferTransports.h>
......
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