diff --git a/src/brpc/nshead_service.cpp b/src/brpc/nshead_service.cpp index 0f043e2300..0371baaefd 100644 --- a/src/brpc/nshead_service.cpp +++ b/src/brpc/nshead_service.cpp @@ -26,15 +26,13 @@ namespace brpc { BAIDU_CASSERT(sizeof(nshead_t) == 36, sizeof_nshead_must_be_36); NsheadService::NsheadService() : _additional_space(0) { - _status = new (std::nothrow) MethodStatus; - LOG_IF(FATAL, _status == NULL) << "Fail to new MethodStatus"; + _status = new MethodStatus; } NsheadService::NsheadService(const NsheadServiceOptions& options) : _status(NULL), _additional_space(options.additional_space) { if (options.generate_status) { - _status = new (std::nothrow) MethodStatus; - LOG_IF(FATAL, _status == NULL) << "Fail to new MethodStatus"; + _status = new MethodStatus; } } diff --git a/src/brpc/rpc_pb_message_factory.h b/src/brpc/rpc_pb_message_factory.h index e65c8f144a..20d27a0fcb 100644 --- a/src/brpc/rpc_pb_message_factory.h +++ b/src/brpc/rpc_pb_message_factory.h @@ -65,7 +65,7 @@ namespace internal { // For more details, see `google::protobuf::ArenaOptions'. template struct ArenaRpcPBMessages : public RpcPBMessages { - struct ArenaOptionsWrapper { + class ArenaOptionsWrapper { public: ArenaOptionsWrapper() { options.start_block_size = StartBlockSize; diff --git a/src/brpc/server.h b/src/brpc/server.h index 2cf34dbd82..f833325cde 100644 --- a/src/brpc/server.h +++ b/src/brpc/server.h @@ -714,7 +714,7 @@ friend class Controller; template int SetServiceMaxConcurrency(T* service) { - if (NULL != service) { + if (NULL != service && NULL != service->_status) { const AdaptiveMaxConcurrency* amc = &service->_max_concurrency; if (amc->type() == AdaptiveMaxConcurrency::UNLIMITED) { amc = &_options.method_max_concurrency; diff --git a/src/brpc/thrift_service.cpp b/src/brpc/thrift_service.cpp index 283ea48bf0..24b2439024 100644 --- a/src/brpc/thrift_service.cpp +++ b/src/brpc/thrift_service.cpp @@ -23,8 +23,7 @@ namespace brpc { ThriftService::ThriftService() { - _status = new (std::nothrow) MethodStatus; - LOG_IF(FATAL, _status == NULL) << "Fail to new MethodStatus"; + _status = new MethodStatus; } ThriftService::~ThriftService() {