X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=main.cpp;h=c89ec72ff44457352c66ebb5be638a5fbc28bc66;hp=c626f46aa26060aab8b09eb2b43c8dfaf269c539;hb=7c26826d3c485f4f18a6c427f520dc470e68f94a;hpb=1731013fbbc58f5670e5c399e3b89835e65372cc diff --git a/main.cpp b/main.cpp index c626f46..c89ec72 100644 --- a/main.cpp +++ b/main.cpp @@ -16,8 +16,8 @@ #include #include -#include "accesslog.h" #include "acceptor.h" +#include "accesslog.h" #include "config.h" #include "input.h" #include "log.h" @@ -25,6 +25,7 @@ #include "serverpool.h" #include "state.pb.h" #include "stats.h" +#include "stream.h" #include "util.h" #include "version.h" @@ -49,6 +50,10 @@ void hup(int signum) } } +void do_nothing(int signum) +{ +} + CubemapStateProto collect_state(const timeval &serialize_start, const vector acceptors, const multimap inputs, @@ -238,6 +243,7 @@ int main(int argc, char **argv) { signal(SIGHUP, hup); signal(SIGINT, hup); + signal(SIGUSR1, do_nothing); // Used in internal signalling. signal(SIGPIPE, SIG_IGN); // Parse options. @@ -341,8 +347,21 @@ start: // Deserialize the streams. for (int i = 0; i < loaded_state.streams_size(); ++i) { - servers->add_stream_from_serialized(loaded_state.streams(i)); - deserialized_stream_ids.insert(loaded_state.streams(i).stream_id()); + const StreamProto &stream = loaded_state.streams(i); + + vector data_fds; + for (int j = 0; j < stream.data_fds_size(); ++j) { + data_fds.push_back(stream.data_fds(j)); + } + + // Older versions stored the data once in the protobuf instead of + // sending around file descriptors. + if (data_fds.empty() && stream.has_data()) { + data_fds.push_back(make_tempfile(stream.data())); + } + + servers->add_stream_from_serialized(stream, data_fds); + deserialized_stream_ids.insert(stream.stream_id()); } // Deserialize the inputs. Note that we don't actually add them to any stream yet.