From: Carl Hetherington Date: Wed, 20 May 2015 15:29:25 +0000 (+0100) Subject: Merge branch '2.0' of git.carlh.net:git/dcpomatic into 2.0 X-Git-Tag: v2.0.48~89 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=6f0a590bc3266f21ba577116219bd019e891d480;hp=b433d33bcbfccf29171fe24c55fdee550a8c36aa Merge branch '2.0' of git.carlh.net:git/dcpomatic into 2.0 --- diff --git a/src/lib/server.cc b/src/lib/server.cc index 9b3b3808b..50ac4e786 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -104,6 +104,9 @@ Server::process (shared_ptr socket, struct timeval& after_read, struct t string s (buffer.get()); shared_ptr xml (new cxml::Document ("EncodingRequest")); xml->read_string (s); + /* This is a double-check; the server shouldn't even be on the candidate list + if it is the wrong version, but it doesn't hurt to make sure here. + */ if (xml->number_child ("Version") != SERVER_LINK_VERSION) { cerr << "Mismatched server/client versions\n"; LOG_ERROR_NC ("Mismatched server/client versions"); @@ -248,6 +251,7 @@ Server::broadcast_received () xmlpp::Document doc; xmlpp::Element* root = doc.create_root_node ("ServerAvailable"); root->add_child("Threads")->add_child_text (raw_convert (_worker_threads.size ())); + root->add_child("Version")->add_child_text (raw_convert (SERVER_LINK_VERSION)); string xml = doc.write_to_string ("UTF-8"); if (_verbose) { diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc index b4b400b52..726437ea5 100644 --- a/src/lib/server_finder.cc +++ b/src/lib/server_finder.cc @@ -166,7 +166,7 @@ ServerFinder::handle_accept (boost::system::error_code ec, shared_ptr so xml->read_string (s); string const ip = socket->socket().remote_endpoint().address().to_string (); - if (!server_found (ip)) { + if (!server_found (ip) && xml->optional_number_child("Version").get_value_or (0) == SERVER_LINK_VERSION) { ServerDescription sd (ip, xml->number_child ("Threads")); { boost::mutex::scoped_lock lm (_mutex);