Supporters update.
[dcpomatic.git] / src / lib / encode_server_finder.h
index 58dee7e641227b0b4e19f639d258fb5ff396263a..f8a30af54b295f9a3d6906bd5ab3b878ee6fe805 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 /** @file  src/lib/encode_server_finder.h
  *  @brief EncodeServerFinder class.
  */
 
-#include "signaller.h"
-#include "encode_server_description.h"
+
 #include "config.h"
+#include "encode_server_description.h"
 #include "exception_store.h"
+#include "signaller.h"
 #include <boost/signals2.hpp>
 #include <boost/thread/condition.hpp>
 
+
 class Socket;
 
+
 /** @class EncodeServerFinder
  *  @brief Locater of encoding servers.
  *
@@ -48,8 +52,7 @@ public:
 
        void stop ();
 
-       std::list<EncodeServerDescription> good_servers () const;
-       std::list<EncodeServerDescription> bad_servers () const;
+       std::list<EncodeServerDescription> servers () const;
 
        /** Emitted whenever the list of servers changes */
        boost::signals2::signal<void ()> ServersListChanged;
@@ -63,30 +66,29 @@ private:
        void search_thread ();
        void listen_thread ();
 
-       boost::optional<std::list<EncodeServerDescription>::iterator> server_found (std::string);
        void start_accept ();
-       void handle_accept (boost::system::error_code ec, boost::shared_ptr<Socket> socket);
+       void handle_accept (boost::system::error_code ec);
 
        void config_changed (Config::Property what);
 
        /** Thread to periodically issue broadcasts and requests to find encoding servers */
-       boost::thread* _search_thread;
+       boost::thread _search_thread;
        /** Thread to listen to the responses from servers */
-       boost::thread* _listen_thread;
+       boost::thread _listen_thread;
 
-       /** Available servers with the correct link version */
-       std::list<EncodeServerDescription> _good_servers;
-       /** Available servers with an incorrect link version */
-       std::list<EncodeServerDescription> _bad_servers;
-       /** Mutex for _good_servers and _bad_servers */
+       /** Available servers */
+       std::list<EncodeServerDescription> _servers;
+       /** Mutex for _servers */
        mutable boost::mutex _servers_mutex;
 
        boost::asio::io_service _listen_io_service;
-       boost::shared_ptr<boost::asio::ip::tcp::acceptor> _listen_acceptor;
+       std::shared_ptr<boost::asio::ip::tcp::acceptor> _listen_acceptor;
        bool _stop;
 
        boost::condition _search_condition;
        boost::mutex _search_condition_mutex;
 
+       std::shared_ptr<Socket> _accept_socket;
+
        static EncodeServerFinder* _instance;
 };