Made wesnothd work if built on windows
Disabled handling of SIGHUP on windows because trying to add it to signal set causes an exception. Do not disable asio's thread support on windows since it causes deadline_timer to throw.
This commit is contained in:
parent
575b6dbb0b
commit
c8cdbcfe22
3 changed files with 10 additions and 0 deletions
|
@ -19,7 +19,9 @@
|
|||
#include "simple_wml.hpp"
|
||||
#include "player.hpp"
|
||||
|
||||
#ifndef _WIN32
|
||||
#define BOOST_ASIO_DISABLE_THREADS
|
||||
#endif
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
|
|
@ -406,7 +406,9 @@ server::server(int port, bool keep_alive, const std::string& config_file, size_t
|
|||
last_stats_(last_ping_),
|
||||
last_uh_clean_(last_ping_),
|
||||
cmd_handlers_(),
|
||||
#ifndef _WIN32
|
||||
sighup_(io_service_, SIGHUP),
|
||||
#endif
|
||||
sigs_(io_service_, SIGINT, SIGTERM),
|
||||
timer_(io_service_)
|
||||
{
|
||||
|
@ -424,10 +426,13 @@ server::server(int port, bool keep_alive, const std::string& config_file, size_t
|
|||
load_config();
|
||||
ban_manager_.read();
|
||||
|
||||
#ifndef _WIN32
|
||||
sighup_.async_wait(boost::bind(&server::handle_sighup, this, _1, _2));
|
||||
#endif
|
||||
sigs_.async_wait(boost::bind(&server::handle_termination, this, _1, _2));
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
void server::handle_sighup(const boost::system::error_code& error, int) {
|
||||
assert(!error);
|
||||
|
||||
|
@ -438,6 +443,7 @@ void server::handle_sighup(const boost::system::error_code& error, int) {
|
|||
|
||||
sighup_.async_wait(boost::bind(&server::handle_sighup, this, _1, _2));
|
||||
}
|
||||
#endif
|
||||
|
||||
void server::handle_termination(const boost::system::error_code& error, int signal_number)
|
||||
{
|
||||
|
|
|
@ -232,8 +232,10 @@ private:
|
|||
void searchlog_handler(const std::string &, const std::string &, std::string &, std::ostringstream *);
|
||||
void dul_handler(const std::string &, const std::string &, std::string &, std::ostringstream *);
|
||||
|
||||
#ifndef _WIN32
|
||||
boost::asio::signal_set sighup_;
|
||||
void handle_sighup(const boost::system::error_code& error, int signal_number);
|
||||
#endif
|
||||
boost::asio::signal_set sigs_;
|
||||
void handle_termination(const boost::system::error_code& error, int signal_number);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue