Various thread cleanups.
[dcpomatic.git] / src / lib / encode_server_finder.h
index 90031d27b36c9603178ce4a8ee2161564b8bb22b..78b72fa9cc079e42706382bf58497ac193aa4724 100644 (file)
@@ -48,8 +48,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,22 +62,20 @@ private:
        void search_thread ();
        void listen_thread ();
 
-       bool server_found (std::string) const;
+       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 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;