nghttpx: Use raw pointer for config

This commit is contained in:
Tatsuhiro Tsujikawa 2017-03-15 23:13:14 +09:00
parent 9cc223d419
commit b1fee8ff63
1 changed files with 7 additions and 6 deletions

View File

@ -63,21 +63,22 @@
namespace shrpx { namespace shrpx {
namespace { namespace {
std::unique_ptr<Config> config; Config *config;
} // namespace } // namespace
constexpr auto SHRPX_UNIX_PATH_PREFIX = StringRef::from_lit("unix:"); 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<Config> replace_config(std::unique_ptr<Config> another) { std::unique_ptr<Config> replace_config(std::unique_ptr<Config> another) {
config.swap(another); auto p = config;
return another; config = another.release();
return std::unique_ptr<Config>(p);
} }
void create_config() { config = make_unique<Config>(); } void create_config() { config = new Config(); }
Config::~Config() { Config::~Config() {
auto &upstreamconf = http2.upstream; auto &upstreamconf = http2.upstream;