From 6629fdf64e7db529db574f2f8f6600ebd797d5ff 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 d73cb324488..3b88494157e 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -333,6 +333,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_(), @@ -499,8 +500,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 5987c10d777..a4c3f3121d6 100644 --- a/src/server/server.hpp +++ b/src/server/server.hpp @@ -106,6 +106,7 @@ private: /** server socket/fifo. */ boost::scoped_ptr input_; + std::string input_path_; const std::string config_file_; config cfg_;