From f7addcf7d00621f0973f2c6a997893ff3d7f6c3e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 7 Mar 2018 11:43:04 +0100 Subject: Add version string to management server --- doc/show_dabmux_stats.py | 8 +++++--- src/ManagementServer.cpp | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/show_dabmux_stats.py b/doc/show_dabmux_stats.py index f781839..1216593 100755 --- a/doc/show_dabmux_stats.py +++ b/doc/show_dabmux_stats.py @@ -22,10 +22,12 @@ def connect(): sock.connect("tcp://localhost:12720") sock.send("info") - version = json.loads(sock.recv()) + infojson = json.loads(sock.recv()) - if not version['service'].startswith("ODR-DabMux"): - sys.stderr.write("Wrong version\n") + sys.stderr.write("Statistics from ODR-DabMux {}\n".format(infojson['version'])) + + if not infojson['service'].startswith("ODR-DabMux"): + sys.stderr.write("This is not ODR-DabMux: {}\n".format(infojson['service'])) sys.exit(1) return sock diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp index cd70b77..092b257 100644 --- a/src/ManagementServer.cpp +++ b/src/ManagementServer.cpp @@ -298,14 +298,24 @@ void ManagementServer::handle_message(zmq::message_t& zmq_message) if (data == "info") { answer << - "{ \"service\": \"" << + "{ " << + "\"service\": \"" << PACKAGE_NAME << " " << #if defined(GITVERSION) GITVERSION << #else PACKAGE_VERSION << #endif - " MGMT Server\" }\n"; + " MGMT Server\", " + << + "\"version\": \"" << +#if defined(GITVERSION) + GITVERSION << +#else + PACKAGE_VERSION << +#endif + "\" " + << "}\n"; } else if (data == "config") { answer << getStatConfigJSON(); -- cgit v1.2.3