summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-02-04 23:38:08 +0000
committerCarl Hetherington <cth@carlh.net>2018-02-04 23:38:08 +0000
commit918124fb0b2fdf05bf98aee2c74c85387f1d8638 (patch)
tree209154022d91c7381c2ed1b2b00f01ebe14997e6 /src/lib
parent9a5f1ef94b9916f5cd5996255007200bf61af7bf (diff)
Listen for server replies on different ports on main and batch, and get servers to send replies to both (#1190).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/encode_server.cc14
-rw-r--r--src/lib/encode_server_finder.cc6
-rw-r--r--src/lib/encode_server_finder.h2
-rw-r--r--src/lib/types.h8
-rw-r--r--src/lib/util.cc1
-rw-r--r--src/lib/util.h1
6 files changed, 24 insertions, 8 deletions
diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc
index 7bef82b26..332c7ab46 100644
--- a/src/lib/encode_server.cc
+++ b/src/lib/encode_server.cc
@@ -277,9 +277,19 @@ EncodeServer::broadcast_received ()
if (_verbose) {
cout << "Offering services to master " << _broadcast.send_endpoint.address().to_string () << "\n";
}
- shared_ptr<Socket> socket (new Socket);
+
+ try {
+ shared_ptr<Socket> socket (new Socket);
+ socket->connect (boost::asio::ip::tcp::endpoint (_broadcast.send_endpoint.address(), MAIN_SERVER_PRESENCE_PORT));
+ socket->write (xml.length() + 1);
+ socket->write ((uint8_t *) xml.c_str(), xml.length() + 1);
+ } catch (...) {
+
+ }
+
try {
- socket->connect (boost::asio::ip::tcp::endpoint (_broadcast.send_endpoint.address(), SERVER_PRESENCE_PORT));
+ shared_ptr<Socket> socket (new Socket);
+ socket->connect (boost::asio::ip::tcp::endpoint (_broadcast.send_endpoint.address(), BATCH_SERVER_PRESENCE_PORT));
socket->write (xml.length() + 1);
socket->write ((uint8_t *) xml.c_str(), xml.length() + 1);
} catch (...) {
diff --git a/src/lib/encode_server_finder.cc b/src/lib/encode_server_finder.cc
index 2796df8f5..267fbb62a 100644
--- a/src/lib/encode_server_finder.cc
+++ b/src/lib/encode_server_finder.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -157,7 +157,9 @@ try {
using namespace boost::asio::ip;
try {
- _listen_acceptor.reset (new tcp::acceptor (_listen_io_service, tcp::endpoint (tcp::v4(), SERVER_PRESENCE_PORT)));
+ _listen_acceptor.reset (
+ new tcp::acceptor (_listen_io_service, tcp::endpoint (tcp::v4(), is_batch_converter ? BATCH_SERVER_PRESENCE_PORT : MAIN_SERVER_PRESENCE_PORT))
+ );
} catch (...) {
boost::throw_exception (NetworkError (_("Could not listen for remote encode servers. Perhaps another instance of DCP-o-matic is running.")));
}
diff --git a/src/lib/encode_server_finder.h b/src/lib/encode_server_finder.h
index da610bd54..46d66b191 100644
--- a/src/lib/encode_server_finder.h
+++ b/src/lib/encode_server_finder.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
diff --git a/src/lib/types.h b/src/lib/types.h
index 0702c8734..8f99b8881 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -74,10 +74,12 @@ namespace xmlpp {
#define ENCODE_FRAME_PORT (Config::instance()->server_port_base())
/** Port on which EncodeServer listens for DCPOMATIC_HELLO from masters */
#define HELLO_PORT (Config::instance()->server_port_base()+1)
-/** Port on which EncodeServerFinder listens for replies to DCPOMATIC_HELLO from servers */
-#define SERVER_PRESENCE_PORT (Config::instance()->server_port_base()+2)
+/** Port on which EncodeServerFinder in the main DCP-o-matic listens for replies to DCPOMATIC_HELLO from servers */
+#define MAIN_SERVER_PRESENCE_PORT (Config::instance()->server_port_base()+2)
+/** Port on which EncodeServerFinder in the batch converter listens for replies to DCPOMATIC_HELLO from servers */
+#define BATCH_SERVER_PRESENCE_PORT (Config::instance()->server_port_base()+3)
/** Port on which batch converter listens for job requests */
-#define BATCH_JOB_PORT (Config::instance()->server_port_base()+3)
+#define BATCH_JOB_PORT (Config::instance()->server_port_base()+4)
typedef std::vector<boost::shared_ptr<Content> > ContentList;
typedef std::vector<boost::shared_ptr<FFmpegContent> > FFmpegContentList;
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 8ed878561..68cded2a3 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -104,6 +104,7 @@ using dcp::locale_convert;
* in during App::onInit().
*/
string program_name;
+bool is_batch_converter = false;
static boost::thread::id ui_thread;
static boost::filesystem::path backtrace_file;
diff --git a/src/lib/util.h b/src/lib/util.h
index 53a0a2d66..5ca198ebb 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -59,6 +59,7 @@ namespace dcp {
#define MAX_KDM_SIZE (256 * 1024)
extern std::string program_name;
+extern bool is_batch_converter;
struct AVSubtitle;
class AudioBuffers;