- fprintf(stderr, "Deserializing state from previous process... ");
- int state_fd = atoi(argv[3]);
- CubemapStateProto loaded_state = read_tempfile(state_fd);
+ log(INFO, "Cubemap " SERVER_VERSION " starting.");
+ if (config.access_log_file.empty()) {
+ // Create a dummy logger.
+ access_log = new AccessLogThread();
+ } else {
+ access_log = new AccessLogThread(config.access_log_file);
+ }
+ access_log->run();
+
+ servers = new ServerPool(config.num_servers);
+
+ // Find all the streams that are to be deleted.
+ set<string> deleted_urls;
+ find_deleted_streams(config, &deleted_urls);
+
+ CubemapStateProto loaded_state;
+ timespec serialize_start;
+ set<string> deserialized_urls;
+ map<sockaddr_in6, Acceptor *, Sockaddr6Compare> deserialized_acceptors;
+ multimap<InputKey, InputWithRefcount> inputs; // multimap due to older versions without deduplication.
+ if (state_fd != -1) {
+ log(INFO, "Deserializing state from previous process...");
+ string serialized;
+ if (!read_tempfile_and_close(state_fd, &serialized)) {
+ exit(1);
+ }
+ if (!loaded_state.ParseFromString(serialized)) {
+ log(ERROR, "Failed deserialization of state.");
+ exit(1);
+ }