From 6fa353595ce8f784b7d5004a6c38c78bddae94c7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 6 Dec 2015 20:17:47 +0000 Subject: Split EncodeServer into that and Server. --- src/lib/encode_server.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/lib/encode_server.h') diff --git a/src/lib/encode_server.h b/src/lib/encode_server.h index f6f1fc9b9..d0c061eb3 100644 --- a/src/lib/encode_server.h +++ b/src/lib/encode_server.h @@ -21,9 +21,10 @@ #define DCPOMATIC_ENCODE_SERVER_H /** @file src/encode_server.h - * @brief Server class. + * @brief EncodeServer class. */ +#include "server.h" #include "exception_store.h" #include #include @@ -37,34 +38,28 @@ class Log; * @brief A class to run a server which can accept requests to perform JPEG2000 * encoding work. */ -class EncodeServer : public ExceptionStore, public boost::noncopyable +class EncodeServer : public Server, public ExceptionStore { public: - EncodeServer (boost::shared_ptr log, bool verbose); + EncodeServer (boost::shared_ptr log, bool verbose, int num_threads); ~EncodeServer (); - void run (int num_threads); + void run (); private: + void handle (boost::shared_ptr); void worker_thread (); int process (boost::shared_ptr socket, struct timeval &, struct timeval &); void broadcast_thread (); void broadcast_received (); - void start_accept (); - void handle_accept (boost::shared_ptr, boost::system::error_code const &); - - bool _terminate; std::vector _worker_threads; std::list > _queue; - boost::mutex _worker_mutex; boost::condition _full_condition; boost::condition _empty_condition; boost::shared_ptr _log; bool _verbose; - - boost::asio::io_service _io_service; - boost::asio::ip::tcp::acceptor _acceptor; + int _num_threads; struct Broadcast { -- cgit v1.2.3