Merge master.
[dcpomatic.git] / src / lib / server.h
index b925031eb2df667cfff90f64a71eacdf3ecb6d7f..b340bba077953c7320c0fb9f1820e3ca2cf2a556 100644 (file)
@@ -90,6 +90,7 @@ class Server : public ExceptionStore, public boost::noncopyable
 {
 public:
        Server (boost::shared_ptr<Log> log, bool verbose);
+       ~Server ();
 
        void run (int num_threads);
 
@@ -98,6 +99,10 @@ private:
        int process (boost::shared_ptr<Socket> socket, struct timeval &, struct timeval &);
        void broadcast_thread ();
        void broadcast_received ();
+       void start_accept ();
+       void handle_accept (boost::shared_ptr<Socket>, boost::system::error_code const &);
+
+       bool _terminate;
 
        std::vector<boost::thread *> _worker_threads;
        std::list<boost::shared_ptr<Socket> > _queue;
@@ -107,6 +112,11 @@ private:
        boost::shared_ptr<Log> _log;
        bool _verbose;
 
+       boost::asio::io_service _io_service;
+       boost::asio::ip::tcp::acceptor _acceptor;
+
+       int _num_threads;
+
        struct Broadcast {
 
                Broadcast ()
@@ -118,6 +128,7 @@ private:
                boost::asio::ip::udp::socket* socket;
                char buffer[64];
                boost::asio::ip::udp::endpoint send_endpoint;
+               boost::asio::io_service io_service;
                
        } _broadcast;
 };