chenBright commented on code in PR #2872: URL: https://github.com/apache/brpc/pull/2872#discussion_r1914533649
########## src/brpc/server.cpp: ########## @@ -814,23 +855,16 @@ int Server::StartInternal(const butil::EndPoint& endpoint, return -1; } - if (&_options == opt) { - // do nothing - } else if (opt) { - if (_options.rpc_pb_message_factory != opt->rpc_pb_message_factory) { - delete _options.rpc_pb_message_factory; - _options.rpc_pb_message_factory = NULL; - } - - _options = *opt; + if (opt) { + copy_server_option(_options, *opt); } else { + // Manual free here is because new occured in constructor delete _options.rpc_pb_message_factory; _options.rpc_pb_message_factory = NULL; // Always reset to default options explicitly since `_options' // may be the options for the last run or even bad options _options = ServerOptions(); - _options.rpc_pb_message_factory = new DefaultRpcPBMessageFactory(); Review Comment: I think it's best to keep this change and keep ServerOptions. rpc_pb_message_factory NULL. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org