X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=main.cpp;h=e8fa4e822ce720be53dc29f03de40ed31b1addc6;hp=07273141fe04b5ec17bf0e3de7394deb414b501a;hb=03569c70282f68a4bc9b259fbf5b7a2b4c5594b3;hpb=40ed7df894c8645c132a5bea2bfb12a9be2b82ef diff --git a/main.cpp b/main.cpp index 0727314..e8fa4e8 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -214,6 +213,9 @@ bool dry_run_config(const std::string &argv0, const std::string &config_filename int main(int argc, char **argv) { + signal(SIGHUP, hup); + signal(SIGPIPE, SIG_IGN); + // Parse options. int state_fd = -1; bool test_config = false; @@ -302,8 +304,6 @@ start: // Find all streams in the configuration file, and create them. create_streams(config, deserialized_stream_ids, &deserialized_inputs); - servers->run(); - vector acceptors = create_acceptors(config, &deserialized_acceptors); vector inputs = create_inputs(config, &deserialized_inputs); @@ -316,6 +316,8 @@ start: for (int i = 0; i < loaded_state.clients_size(); ++i) { servers->add_client_from_serialized(loaded_state.clients(i)); } + + servers->run(); // Start writing statistics. StatsThread *stats_thread = NULL; @@ -324,8 +326,6 @@ start: stats_thread->run(); } - signal(SIGHUP, hup); - struct timeval server_start; gettimeofday(&server_start, NULL); if (state_fd != -1) {