summaryrefslogtreecommitdiff
path: root/src/lib/server.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-20 16:29:15 +0100
committerCarl Hetherington <cth@carlh.net>2015-05-20 16:29:15 +0100
commitada329f77032590bae1e18d05a87f94c82e14a55 (patch)
tree147dca4dcbf5de5dfd51749cb2f342b278e1b578 /src/lib/server.cc
parentf91d0e7734dc2c42ed9c9b953c6a57e530ea43f8 (diff)
Don't put servers on the list if they report the wrong link version.
Diffstat (limited to 'src/lib/server.cc')
-rw-r--r--src/lib/server.cc4
1 files changed, 4 insertions, 0 deletions
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> socket, struct timeval& after_read, struct t
string s (buffer.get());
shared_ptr<cxml::Document> 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<int> ("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<string> (_worker_threads.size ()));
+ root->add_child("Version")->add_child_text (raw_convert<string> (SERVER_LINK_VERSION));
string xml = doc.write_to_string ("UTF-8");
if (_verbose) {