Procházet zdrojové kódy

Removed only_one, just send SIGUSR1, SIGTERM.

Steve Thielemann před 3 roky
rodič
revize
ba07bde4fd
3 změnil soubory, kde provedl 3 přidání a 6 odebrání
  1. 1 0
      pch.hpp
  2. 2 5
      session.cpp
  3. 0 1
      session.h

+ 1 - 0
pch.hpp

@@ -2,6 +2,7 @@
 #pragma once
 #include <boost/asio.hpp>
 #include <boost/log/core.hpp>
+#include <boost/asio/signal_set.hpp>
 #include <boost/log/utility/setup/console.hpp>
 #include <boost/log/trivial.hpp>
 #include <boost/log/support/date_time.hpp>

+ 2 - 5
session.cpp

@@ -689,11 +689,8 @@ Server::Server(boost::asio::io_service &io_service,
                const boost::asio::ip::tcp::endpoint &endpoint, std::string host,
                std::string port)
     : io_service_{io_service}, acceptor_{io_service_, endpoint},
-      signal_{io_service, SIGUSR1}, host_{host}, port_{port} {
-  only_one = false;
+      signal_{io_service, SIGUSR1, SIGTERM}, host_{host}, port_{port} {
   keep_accepting = true;
-  if (CONFIG["one_connection"])
-    only_one = CONFIG["one_connection"].as<int>() == 1;
 
   BUGZ_LOG(info) << "Server::Server()";
   signal_.async_wait(boost::bind(&Server::on_signal, this,
@@ -703,7 +700,7 @@ Server::Server(boost::asio::io_service &io_service,
 }
 
 void Server::on_signal(const boost::system::error_code &ec, int signal) {
-  BUGZ_LOG(info) << "SIGUSR1";
+  BUGZ_LOG(info) << "on_signal() :" << signal;
   keep_accepting = false;
   boost::system::error_code error;
   acceptor_.cancel(error);

+ 0 - 1
session.h

@@ -203,7 +203,6 @@ private:
    *
    */
   std::string port_;
-  bool only_one;
 };
 
 #ifdef NEVERMORE