From 74dbef4771ebe1b86a0eb5f12579fbb0fad4b846 Mon Sep 17 00:00:00 2001 From: "Ignacio R. Morelle" Date: Tue, 24 Jun 2014 20:47:58 -0400 Subject: [PATCH] wesnothd: Only reset the commands FIFO stream when reloading if needed May or may not fix the issue noted in commit 62eb55a5a712b3e2157cf7fc0bb12873c4f0a574 regarding the SIGHUP handler, which is in charge of scheduling load_config() to run. Rather unfortunately, I'm unable to reproduce the issue on my own machine, so I'll have to take this to production and test it live. --- src/server/server.cpp | 8 ++++++-- src/server/server.hpp | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/server.cpp b/src/server/server.cpp index 514f99dc1d6b..beb37eaefae1 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -332,6 +332,7 @@ server::server(int port, const std::string& config_file, size_t min_threads, not_logged_in_(), rooms_(players_), input_(), + input_path_(), config_file_(config_file), cfg_(read_config()), accepted_versions_(), @@ -498,8 +499,11 @@ void server::load_config() { # endif #endif const std::string fifo_path = (cfg_["fifo_path"].empty() ? std::string(FIFODIR) + "/socket" : std::string(cfg_["fifo_path"])); - input_.reset(); - input_.reset(new input_stream(fifo_path)); + // Reset (replace) the input stream only if the FIFO path changed. + if(fifo_path != input_path_) { + input_.reset(new input_stream(fifo_path)); + } + input_path_ = fifo_path; save_replays_ = cfg_["save_replays"].to_bool(); replay_save_path_ = cfg_["replay_save_path"].str(); diff --git a/src/server/server.hpp b/src/server/server.hpp index 7556d54c1827..46f14e0bbed9 100644 --- a/src/server/server.hpp +++ b/src/server/server.hpp @@ -101,6 +101,7 @@ class server /** server socket/fifo. */ boost::scoped_ptr input_; + std::string input_path_; const std::string config_file_; config cfg_;