diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 3e24bc6e..f29c0db3 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -63,21 +63,22 @@ namespace shrpx { namespace { -std::unique_ptr config; +Config *config; } // namespace constexpr auto SHRPX_UNIX_PATH_PREFIX = StringRef::from_lit("unix:"); -const Config *get_config() { return config.get(); } +const Config *get_config() { return config; } -Config *mod_config() { return config.get(); } +Config *mod_config() { return config; } std::unique_ptr replace_config(std::unique_ptr another) { - config.swap(another); - return another; + auto p = config; + config = another.release(); + return std::unique_ptr(p); } -void create_config() { config = make_unique(); } +void create_config() { config = new Config(); } Config::~Config() { auto &upstreamconf = http2.upstream;