X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fserver.cc;h=1f3f61e425a0392b791453245e0fcd6b2cd7b671;hb=cadf2d574d144098fffa3c61e0a2be88f496cac6;hp=bad7ad89310d95ccb8619488e13ae873771de31f;hpb=4782e1c0beec98560950a616902669f09a98faae;p=dcpomatic.git diff --git a/src/lib/server.cc b/src/lib/server.cc index bad7ad893..1f3f61e42 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -59,36 +59,6 @@ using boost::optional; using boost::lexical_cast; using libdcp::Size; -ServerDescription::ServerDescription (shared_ptr node) -{ - _host_name = node->string_child ("HostName"); - _threads = node->number_child ("Threads"); -} - -void -ServerDescription::as_xml (xmlpp::Node* root) const -{ - root->add_child("HostName")->add_child_text (_host_name); - root->add_child("Threads")->add_child_text (boost::lexical_cast (_threads)); -} - -/** Create a server description from a string of metadata returned from as_metadata(). - * @param v Metadata. - * @return ServerDescription, or 0. - */ -optional -ServerDescription::create_from_metadata (string v) -{ - vector b; - split (b, v, is_any_of (" ")); - - if (b.size() != 2) { - return optional (); - } - - return ServerDescription (b[0], atoi (b[1].c_str ())); -} - Server::Server (shared_ptr log, bool verbose) : _log (log) , _verbose (verbose) @@ -209,7 +179,7 @@ Server::run (int num_threads) { _log->log (String::compose ("Server starting with %1 threads", num_threads)); if (_verbose) { - cout << "DCP-o-matic server started with " << num_threads << " threads.\n"; + cout << "DCP-o-matic server starting with " << num_threads << " threads.\n"; } for (int i = 0; i < num_threads; ++i) { @@ -243,6 +213,7 @@ Server::run (int num_threads) void Server::broadcast_thread () +try { boost::asio::io_service io_service; @@ -261,6 +232,10 @@ Server::broadcast_thread () io_service.run (); } +catch (...) +{ + store_current (); +} void Server::broadcast_received ()