+
+ // Deserialize the inputs. Note that we don't actually add them to any stream yet.
+ for (int i = 0; i < loaded_state.inputs_size(); ++i) {
+ InputProto serialized_input = loaded_state.inputs(i);
+
+ InputWithRefcount iwr;
+ iwr.input = create_input(serialized_input);
+ iwr.refcount = 0;
+
+ Input::Encoding src_encoding = serialized_input.is_metacube_encoded() ?
+ Input::INPUT_ENCODING_METACUBE :
+ Input::INPUT_ENCODING_RAW;
+ InputKey key(serialized_input.url(), src_encoding);
+ inputs.insert(make_pair(key, iwr));
+ }
+
+ // Deserialize the acceptors.
+ for (int i = 0; i < loaded_state.acceptors_size(); ++i) {
+ AcceptorConfig config;
+ config.addr = extract_address_from_acceptor_proto(loaded_state.acceptors(i));
+ config.certificate_chain = loaded_state.acceptors(i).certificate_chain();
+ config.private_key = loaded_state.acceptors(i).private_key();
+ deserialized_acceptors.insert(make_pair(
+ config,
+ new Acceptor(loaded_state.acceptors(i))));
+ }
+
+ log(INFO, "Deserialization done.");
+ }
+
+ // Add any new inputs coming from the config.
+ create_config_inputs(config, &inputs);
+
+ // 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);
+
+ // Make all the servers create TLS contexts for every TLS keypair we have.
+ for (Acceptor *acceptor : acceptors) {
+ if (acceptor->is_tls()) {
+ servers->create_tls_context_for_acceptor(acceptor);