std::shared_ptr
[dcpomatic.git] / src / lib / server.h
index a72d360261123641f5e21763c18bd3dd552482af..fbcd7e870ff006204739ba26258c26d019dadeb5 100644 (file)
@@ -24,6 +24,7 @@
 #include <boost/thread.hpp>
 #include <boost/asio.hpp>
 #include <boost/thread/condition.hpp>
+#include <boost/noncopyable.hpp>
 #include <string>
 
 class Socket;
@@ -31,23 +32,25 @@ class Socket;
 class Server : public boost::noncopyable
 {
 public:
-       Server (int port);
+       explicit Server (int port, int timeout = 30);
        virtual ~Server ();
 
        virtual void run ();
+       void stop ();
 
 protected:
        boost::mutex _mutex;
        bool _terminate;
 
 private:
-       virtual void handle (boost::shared_ptr<Socket> socket) = 0;
+       virtual void handle (std::shared_ptr<Socket> socket) = 0;
 
        void start_accept ();
-       void handle_accept (boost::shared_ptr<Socket>, boost::system::error_code const &);
+       void handle_accept (std::shared_ptr<Socket>, boost::system::error_code const &);
 
        boost::asio::io_service _io_service;
        boost::asio::ip::tcp::acceptor _acceptor;
+       int _timeout;
 };
 
 #endif