Changes to libdcp API.
[dcpomatic.git] / src / lib / server_finder.h
index 202bee8f920d9610bd82c50b6951ea701199ed25..c0f1feb66e1d329167e55007ec8bdf4f6ac09521 100644 (file)
@@ -17,8 +17,8 @@
 
 */
 
-#include <boost/signals2.hpp>
 #include "server.h"
+#include <boost/signals2.hpp>
 
 class ServerFinder : public ExceptionStore
 {
@@ -26,6 +26,7 @@ public:
        void connect (boost::function<void (ServerDescription)>);
 
        static ServerFinder* instance ();
+       static void drop ();
 
        void disable () {
                _disabled = true;
@@ -33,11 +34,14 @@ public:
 
 private:
        ServerFinder ();
+       ~ServerFinder ();
 
        void broadcast_thread ();
        void listen_thread ();
 
        bool server_found (std::string) const;
+       void start_accept ();
+       void handle_accept (boost::system::error_code ec, boost::shared_ptr<Socket> socket);
 
        boost::signals2::signal<void (ServerDescription)> ServerFound;
 
@@ -51,5 +55,9 @@ private:
        std::list<ServerDescription> _servers;
        mutable boost::mutex _mutex;
 
+       boost::asio::io_service _listen_io_service;
+       boost::shared_ptr<boost::asio::ip::tcp::acceptor> _listen_acceptor;
+       bool _stop;
+
        static ServerFinder* _instance;
 };