summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-06 18:00:53 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-06 18:00:53 +0000
commit7125d8ec2217ae874ce452602465f630f674e786 (patch)
treecb70ee80dbf446a797832ecc2ab2ffa542b00596 /src/lib
parent59602b67d0637817a156b7bd0fc05f96fe41dee5 (diff)
Remove configuration of servers.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc17
-rw-r--r--src/lib/config.h15
-rw-r--r--src/lib/encoder.cc6
-rw-r--r--src/lib/server.cc30
-rw-r--r--src/lib/server.h6
-rw-r--r--src/lib/server_finder.cc7
-rw-r--r--src/lib/server_finder.h6
7 files changed, 12 insertions, 75 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 02feecce8..1a7c64405 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -102,11 +102,6 @@ Config::read ()
}
_server_port_base = b.get ();
- list<shared_ptr<cxml::Node> > servers = f.node_children ("Server");
- for (list<shared_ptr<cxml::Node> >::iterator i = servers.begin(); i != servers.end(); ++i) {
- _servers.push_back (ServerDescription (*i));
- }
-
_tms_ip = f.string_child ("TMSIP");
_tms_path = f.string_child ("TMSPath");
_tms_user = f.string_child ("TMSUser");
@@ -197,11 +192,6 @@ Config::read_old_metadata ()
_default_directory = v;
} else if (k == N_("server_port")) {
_server_port_base = atoi (v.c_str ());
- } else if (k == N_("server")) {
- optional<ServerDescription> server = ServerDescription::create_from_metadata (v);
- if (server) {
- _servers.push_back (server.get ());
- }
} else if (k == N_("tms_ip")) {
_tms_ip = v;
} else if (k == N_("tms_path")) {
@@ -293,11 +283,6 @@ Config::write () const
root->add_child("NumLocalEncodingThreads")->add_child_text (lexical_cast<string> (_num_local_encoding_threads));
root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ());
root->add_child("ServerPortBase")->add_child_text (lexical_cast<string> (_server_port_base));
-
- for (vector<ServerDescription>::const_iterator i = _servers.begin(); i != _servers.end(); ++i) {
- i->as_xml (root->add_child ("Server"));
- }
-
root->add_child("TMSIP")->add_child_text (_tms_ip);
root->add_child("TMSPath")->add_child_text (_tms_path);
root->add_child("TMSUser")->add_child_text (_tms_user);
@@ -334,9 +319,7 @@ Config::write () const
root->add_child("KDMFrom")->add_child_text (_kdm_from);
root->add_child("KDMEmail")->add_child_text (_kdm_email);
- std::cout << "dcpomatic: writing configuration to " << file(false).string() << "\n";
doc.write_to_file_formatted (file(false).string ());
- std::cout << "dcpomatic: wrote configuration to " << file(false).string() << "\n";
}
boost::filesystem::path
diff --git a/src/lib/config.h b/src/lib/config.h
index 07b3d6891..0dcfd3f58 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -31,9 +31,7 @@
#include <libdcp/metadata.h>
#include "dci_metadata.h"
#include "colour_conversion.h"
-#include "server.h"
-class ServerDescription;
class Scaler;
class Filter;
class SoundProcessor;
@@ -64,11 +62,6 @@ public:
return _server_port_base;
}
- /** @return J2K encoding servers to use */
- std::vector<ServerDescription> servers () const {
- return _servers;
- }
-
/** @return The IP address of a TMS that we can copy DCPs to */
std::string tms_ip () const {
return _tms_ip;
@@ -160,11 +153,6 @@ public:
_server_port_base = p;
}
- /** @param s New list of servers */
- void set_servers (std::vector<ServerDescription> s) {
- _servers = s;
- }
-
void set_reference_scaler (Scaler const * s) {
_reference_scaler = s;
}
@@ -274,9 +262,6 @@ private:
* this port and the one above it will be used.
*/
int _server_port_base;
-
- /** J2K encoding servers to use */
- std::vector<ServerDescription> _servers;
/** Scaler to use for the "A" part of A/B comparisons */
Scaler const * _reference_scaler;
/** Filters to use for the "A" part of A/B comparisons */
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index ccaeab18c..eb331551f 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -90,12 +90,6 @@ Encoder::process_begin ()
_threads.push_back (new boost::thread (boost::bind (&Encoder::encoder_thread, this, optional<ServerDescription> ())));
}
- vector<ServerDescription> servers = Config::instance()->servers ();
-
- for (vector<ServerDescription>::iterator i = servers.begin(); i != servers.end(); ++i) {
- add_worker_threads (*i);
- }
-
_writer.reset (new Writer (_film, _job));
ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
}
diff --git a/src/lib/server.cc b/src/lib/server.cc
index 2930e3c4b..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<const cxml::Node> node)
-{
- _host_name = node->string_child ("HostName");
- _threads = node->number_child<int> ("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<string> (_threads));
-}
-
-/** Create a server description from a string of metadata returned from as_metadata().
- * @param v Metadata.
- * @return ServerDescription, or 0.
- */
-optional<ServerDescription>
-ServerDescription::create_from_metadata (string v)
-{
- vector<string> b;
- split (b, v, is_any_of (" "));
-
- if (b.size() != 2) {
- return optional<ServerDescription> ();
- }
-
- return ServerDescription (b[0], atoi (b[1].c_str ()));
-}
-
Server::Server (shared_ptr<Log> log, bool verbose)
: _log (log)
, _verbose (verbose)
diff --git a/src/lib/server.h b/src/lib/server.h
index 9be47bd94..a9b4b1c1c 100644
--- a/src/lib/server.h
+++ b/src/lib/server.h
@@ -59,8 +59,6 @@ public:
, _threads (t)
{}
- ServerDescription (boost::shared_ptr<const cxml::Node>);
-
/* Default copy constructor is fine */
/** @return server's host name or IP address in string form */
@@ -81,10 +79,6 @@ public:
_threads = t;
}
- void as_xml (xmlpp::Node *) const;
-
- static boost::optional<ServerDescription> create_from_metadata (std::string);
-
private:
/** server's host name */
std::string _host_name;
diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc
index 56f52b7fc..941caf4d9 100644
--- a/src/lib/server_finder.cc
+++ b/src/lib/server_finder.cc
@@ -34,7 +34,8 @@ using boost::scoped_array;
ServerFinder* ServerFinder::_instance = 0;
ServerFinder::ServerFinder ()
- : _broadcast_thread (0)
+ : _disabled (false)
+ , _broadcast_thread (0)
, _listen_thread (0)
{
_broadcast_thread = new boost::thread (boost::bind (&ServerFinder::broadcast_thread, this));
@@ -103,6 +104,10 @@ ServerFinder::listen_thread ()
void
ServerFinder::connect (boost::function<void (ServerDescription)> fn)
{
+ if (_disabled) {
+ return;
+ }
+
boost::mutex::scoped_lock lm (_mutex);
/* Emit the current list of servers */
diff --git a/src/lib/server_finder.h b/src/lib/server_finder.h
index 04a7786cf..f964d4e1a 100644
--- a/src/lib/server_finder.h
+++ b/src/lib/server_finder.h
@@ -27,6 +27,10 @@ public:
static ServerFinder* instance ();
+ void disable () {
+ _disabled = true;
+ }
+
private:
ServerFinder ();
@@ -34,6 +38,8 @@ private:
void listen_thread ();
boost::signals2::signal<void (ServerDescription)> ServerFound;
+
+ bool _disabled;
/** Thread to periodically issue broadcasts to find encoding servers */
boost::thread* _broadcast_thread;