Skip to content

Commit

Permalink
wesnothd: Only reset the commands FIFO stream when reloading if needed
Browse files Browse the repository at this point in the history
May or may not fix the issue noted in commit
62eb55a 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.
  • Loading branch information
irydacea committed Jun 26, 2014
1 parent 40c5497 commit 74dbef4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/server.cpp
Expand Up @@ -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_(),
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/server/server.hpp
Expand Up @@ -101,6 +101,7 @@ class server

/** server socket/fifo. */
boost::scoped_ptr<input_stream> input_;
std::string input_path_;

const std::string config_file_;
config cfg_;
Expand Down

0 comments on commit 74dbef4

Please sign in to comment.