Merge master; fix crash on new film.
[dcpomatic.git] / src / lib / server.h
index 7470814431e1c53822d8fd18e443006885506b4e..398401a555dd1eff784ad1d2289677e5258660f2 100644 (file)
 #include <boost/thread.hpp>
 #include <boost/asio.hpp>
 #include <boost/thread/condition.hpp>
+#include <libxml++/libxml++.h>
 #include "log.h"
 
+class Socket;
+
+namespace cxml {
+       class Node;
+}
+
 /** @class ServerDescription
  *  @brief Class to describe a server to which we can send encoding work.
  */
@@ -42,6 +49,8 @@ public:
                , _threads (t)
        {}
 
+       ServerDescription (boost::shared_ptr<const cxml::Node>);
+       
        /** @return server's host name or IP address in string form */
        std::string host_name () const {
                return _host_name;
@@ -60,7 +69,7 @@ public:
                _threads = t;
        }
 
-       std::string as_metadata () const;
+       void as_xml (xmlpp::Node *) const;
        
        static ServerDescription * create_from_metadata (std::string v);
 
@@ -74,18 +83,17 @@ private:
 class Server
 {
 public:
-       Server (Log* log);
+       Server (boost::shared_ptr<Log> log);
 
        void run (int num_threads);
 
 private:
        void worker_thread ();
-       int process (boost::shared_ptr<boost::asio::ip::tcp::socket> socket);
+       int process (boost::shared_ptr<Socket> socket);
 
-       boost::asio::io_service _io_service;
        std::vector<boost::thread *> _worker_threads;
-       std::list<boost::shared_ptr<boost::asio::ip::tcp::socket> > _queue;
+       std::list<boost::shared_ptr<Socket> > _queue;
        boost::mutex _worker_mutex;
        boost::condition _worker_condition;
-       Log* _log;
+       boost::shared_ptr<Log> _log;
 };