+ if (all_urls.count(loaded_state.clients(i).url()) == 0) {
+ safe_close(loaded_state.clients(i).sock());
+ } else {
+ servers->add_client_from_serialized(loaded_state.clients(i), short_response_pool);
+ }
+ }
+
+ short_response_pool.clear(); // No longer needed; the clients have their own refcounts now.
+
+ servers->run();
+
+ // Now delete all inputs that are longer in use, and start the others.
+ for (auto input_it = inputs.begin(); input_it != inputs.end(); ) {
+ if (input_it->second.refcount == 0) {
+ if (input_it->first.second == Input::INPUT_ENCODING_RAW) {
+ log(WARNING, "Raw input '%s' no longer in use, closing.",
+ input_it->first.first.c_str());
+ } else {
+ assert(input_it->first.second == Input::INPUT_ENCODING_METACUBE);
+ log(WARNING, "Metacube input '%s' no longer in use, closing.",
+ input_it->first.first.c_str());
+ }
+ input_it->second.input->close_socket();
+ delete input_it->second.input;
+ inputs.erase(input_it++);
+ } else {
+ input_it->second.input->run();
+ ++input_it;
+ }