+
+ // Deserialize the inputs. Note that we don't actually add them to any stream yet.
+ for (const InputProto &serialized_input : loaded_state.inputs()) {
+ 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 (const AcceptorProto &serialized_acceptor : loaded_state.acceptors()) {
+ AcceptorConfig config;
+ config.addr = extract_address_from_acceptor_proto(serialized_acceptor);
+ config.certificate_chain = serialized_acceptor.certificate_chain();
+ config.private_key = serialized_acceptor.private_key();
+ deserialized_acceptors.insert(make_pair(
+ config,
+ new Acceptor(serialized_acceptor)));
+ }
+
+ 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);