- // All deserialized inputs should now have been taken care of, one way or the other.
- assert(deserialized_inputs.empty());
+ // Find all streams in the configuration file, create them, and connect to the inputs.
+ create_streams(config, deserialized_urls, &inputs);
+ vector<Acceptor *> acceptors = create_acceptors(config, &deserialized_acceptors);
+
+ // Convert old-style timestamps to new-style timestamps for all clients;
+ // this simplifies the sort below.
+ {
+ timespec now_monotonic;
+ if (clock_gettime(CLOCK_MONOTONIC_COARSE, &now_monotonic) == -1) {
+ log(ERROR, "clock_gettime(CLOCK_MONOTONIC_COARSE) failed.");
+ exit(1);
+ }
+ long delta_sec = now_monotonic.tv_sec - time(NULL);
+
+ for (int i = 0; i < loaded_state.clients_size(); ++i) {
+ ClientProto* client = loaded_state.mutable_clients(i);
+ if (client->has_connect_time_old()) {
+ client->set_connect_time_sec(client->connect_time_old() + delta_sec);
+ client->set_connect_time_nsec(now_monotonic.tv_nsec);
+ client->clear_connect_time_old();
+ }
+ }
+ }