]> git.sesse.net Git - cubemap/commitdiff
Move version identification into a common place.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 11 Apr 2013 19:08:14 +0000 (21:08 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 11 Apr 2013 19:08:14 +0000 (21:08 +0200)
httpinput.cpp
main.cpp
version.h [new file with mode: 0644]

index 1db4f91f16e0221f6afcf886111142d7a36a097e..012f5bc0c4f15d2a4da0f425034a7c82a50ff763 100644 (file)
@@ -23,6 +23,7 @@
 #include "server.h"
 #include "serverpool.h"
 #include "parse.h"
+#include "version.h"
 #include "state.pb.h"
 
 using namespace std;
@@ -163,7 +164,7 @@ bool HTTPInput::parse_response(const std::string &request)
        // TODO: Make case-insensitive.
        // XXX: Use a Via: instead?
        if (parameters.count("Server") == 0) {
-               parameters.insert(make_pair("Server", "metacube/0.1"));
+               parameters.insert(make_pair("Server", SERVER_IDENTIFICATION));
        } else {
                for (multimap<string, string>::iterator it = parameters.begin();
                     it != parameters.end();
@@ -171,7 +172,7 @@ bool HTTPInput::parse_response(const std::string &request)
                        if (it->first != "Server") {
                                continue;
                        }
-                       it->second = "metacube/0.1 (reflecting: " + it->second + ")";
+                       it->second = SERVER_IDENTIFICATION " (reflecting: " + it->second + ")";
                }
        }
 
index 04d0d3da33b26bd6ae0a44942964d08c230682b2..e258c86424dddcdd614dd3784d4ef59d40c50725 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -27,6 +27,7 @@
 #include "input.h"
 #include "httpinput.h"
 #include "stats.h"
+#include "version.h"
 #include "state.pb.h"
 
 using namespace std;
@@ -323,7 +324,7 @@ void create_streams(const vector<ConfigLine> &config,
 
 int main(int argc, char **argv)
 {
-       fprintf(stderr, "\nCubemap starting.\n");
+       fprintf(stderr, "\nCubemap " SERVER_VERSION " starting.\n");
 
        struct timeval serialize_start;
        bool is_reexec = false;
diff --git a/version.h b/version.h
new file mode 100644 (file)
index 0000000..5b5596a
--- /dev/null
+++ b/version.h
@@ -0,0 +1,9 @@
+#ifndef _VERSION_H
+#define _VERSION_H
+
+// Version number. Don't expect this to change all that often.
+
+#define SERVER_VERSION "0.1"
+#define SERVER_IDENTIFICATION "Cubemap/" SERVER_VERSION
+
+#endif  // !defined(_VERSION_H)