- // Deserialize the server socket.
- server_sock = loaded_state.server_sock();
- old_port = loaded_state.port();
-
- fprintf(stderr, "done.\n");
- }
-
- // Find all streams in the configuration file, and create them.
- set<string> expecting_stream_ids = deserialized_stream_ids;
- for (unsigned i = 0; i < config.size(); ++i) {
- if (config[i].keyword != "stream") {
- continue;
- }
- if (config[i].arguments.size() != 1) {
- fprintf(stderr, "ERROR: 'stream' takes exactly one argument\n");
- exit(1);
- }
- string stream_id = config[i].arguments[0];
- if (deserialized_stream_ids.count(stream_id) == 0) {
- servers->add_stream(stream_id);
- }
- expecting_stream_ids.erase(stream_id);
- }
-
- // Warn about any servers we've lost.
- // TODO: Make an option (delete=yes?) to actually shut down streams.
- for (set<string>::const_iterator stream_it = expecting_stream_ids.begin();
- stream_it != expecting_stream_ids.end();
- ++stream_it) {
- string stream_id = *stream_it;
- fprintf(stderr, "WARNING: stream '%s' disappeared from the configuration file.\n",
- stream_id.c_str());
- fprintf(stderr, " It will not be deleted, but clients will not get any new inputs.\n");
- if (deserialized_inputs.count(stream_id) != 0) {
- delete deserialized_inputs[stream_id];
- deserialized_inputs.erase(stream_id);
+ // Deserialize the acceptors.
+ for (int i = 0; i < loaded_state.acceptors_size(); ++i) {
+ deserialized_acceptors.insert(make_pair(
+ loaded_state.acceptors(i).port(),
+ new Acceptor(loaded_state.acceptors(i))));