X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fencode_server_finder.h;h=533c9219b33fd18e5ce352b4360da8b92e79b61f;hb=c162f9d8b127f56b8da46b83908000611033e6a5;hp=90031d27b36c9603178ce4a8ee2161564b8bb22b;hpb=ed0b3ee0c5a0ba11d3a1a1dfee8e71238bcab4bd;p=dcpomatic.git diff --git a/src/lib/encode_server_finder.h b/src/lib/encode_server_finder.h index 90031d27b..533c9219b 100644 --- a/src/lib/encode_server_finder.h +++ b/src/lib/encode_server_finder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 Carl Hetherington + Copyright (C) 2013-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,19 +18,23 @@ */ + /** @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 #include + class Socket; + /** @class EncodeServerFinder * @brief Locater of encoding servers. * @@ -48,8 +52,7 @@ public: void stop (); - std::list good_servers () const; - std::list bad_servers () const; + std::list servers () const; /** Emitted whenever the list of servers changes */ boost::signals2::signal ServersListChanged; @@ -63,26 +66,24 @@ private: void search_thread (); void listen_thread (); - bool server_found (std::string) const; + boost::optional::iterator> server_found (std::string); void start_accept (); - void handle_accept (boost::system::error_code ec, boost::shared_ptr socket); + void handle_accept (boost::system::error_code ec, std::shared_ptr 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 _good_servers; - /** Available servers with an incorrect link version */ - std::list _bad_servers; - /** Mutex for _good_servers and _bad_servers */ + /** Available servers */ + std::list _servers; + /** Mutex for _servers */ mutable boost::mutex _servers_mutex; boost::asio::io_service _listen_io_service; - boost::shared_ptr _listen_acceptor; + std::shared_ptr _listen_acceptor; bool _stop; boost::condition _search_condition;