]> git.sesse.net Git - cubemap/blobdiff - main.cpp
Implement --test-config.
[cubemap] / main.cpp
index 64ee29f55fb55b924eb0632935876b5a3cc56ef1..f220cfb7ebb012b718814c337af31581e7d6b339 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -244,16 +244,16 @@ void create_streams(const Config &config,
 
 int main(int argc, char **argv)
 {
-       fprintf(stderr, "\nCubemap " SERVER_VERSION " starting.\n");
-
        // Parse options.
        int state_fd = -1;
+       bool test_config = false;
        for ( ;; ) {
                static const option long_options[] = {
                        { "state", required_argument, 0, 's' },
+                       { "test-config", no_argument, 0, 't' },
                };
                int option_index = 0;
-               int c = getopt_long (argc, argv, "s:", long_options, &option_index);
+               int c = getopt_long (argc, argv, "s:t", long_options, &option_index);
      
                if (c == -1) {
                        break;
@@ -262,6 +262,9 @@ int main(int argc, char **argv)
                case 's':
                        state_fd = atoi(optarg);
                        break;
+               case 't':
+                       test_config = true;
+                       break;
                default:
                        assert(false);
                }
@@ -278,7 +281,11 @@ int main(int argc, char **argv)
        if (!parse_config(config_filename, &config)) {
                exit(1);
        }
+       if (test_config) {
+               exit(0);
+       }
 
+       fprintf(stderr, "\nCubemap " SERVER_VERSION " starting.\n");
        servers = new ServerPool(config.num_servers);
 
        CubemapStateProto loaded_state;
@@ -305,13 +312,6 @@ int main(int argc, char **argv)
                                create_input(loaded_state.inputs(i))));
                } 
 
-               // Convert the acceptor from older serialized formats.
-               if (loaded_state.has_server_sock() && loaded_state.has_port()) {
-                       AcceptorProto *acceptor = loaded_state.add_acceptors();
-                       acceptor->set_server_sock(loaded_state.server_sock());
-                       acceptor->set_port(loaded_state.port());
-               }
-
                // Deserialize the acceptors.
                for (int i = 0; i < loaded_state.acceptors_size(); ++i) {
                        deserialized_acceptors.insert(make_pair(