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

Function copy_and_fill_server_options

src/brpc/server.cpp:780–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

778static bool g_default_ignore_eovercrowded(false);
779
780inline void copy_and_fill_server_options(ServerOptions& dst, const ServerOptions& src) {
781// follow Server::~Server()
782#define FREE_PTR_IF_NOT_REUSED(ptr) \
783 if (dst.ptr != src.ptr) { \
784 delete dst.ptr; \
785 dst.ptr = NULL; \
786 }
787
788 if (&dst != &src) {
789 FREE_PTR_IF_NOT_REUSED(nshead_service);
790
791 #ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
792 FREE_PTR_IF_NOT_REUSED(thrift_service);
793 #endif
794
795 FREE_PTR_IF_NOT_REUSED(baidu_master_service);
796 FREE_PTR_IF_NOT_REUSED(http_master_service);
797 FREE_PTR_IF_NOT_REUSED(rpc_pb_message_factory);
798
799 if (dst.pid_file != src.pid_file && !dst.pid_file.empty()) {
800 unlink(dst.pid_file.c_str());
801 }
802
803 if (dst.server_owns_auth) {
804 FREE_PTR_IF_NOT_REUSED(auth);
805 }
806
807 if (dst.server_owns_interceptor) {
808 FREE_PTR_IF_NOT_REUSED(interceptor);
809 }
810
811 FREE_PTR_IF_NOT_REUSED(redis_service);
812
813 // copy data members directly
814 dst = src;
815 }
816#undef FREE_PTR_IF_NOT_REUSED
817
818 // Create the resource if:
819 // 1. `dst` copied from user and user forgot to create
820 // 2. `dst` created by our
821 if (!dst.rpc_pb_message_factory) {
822 dst.rpc_pb_message_factory = new DefaultRpcPBMessageFactory();
823 }
824}
825
826int Server::StartInternal(const butil::EndPoint& endpoint,
827 const PortRange& port_range,

Callers 1

StartInternalMethod · 0.85

Calls 2

emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected