return acceptors;
}
+void create_config_input(const string &src, multimap<string, InputWithRefcount> *inputs)
+{
+ if (src.empty()) {
+ return;
+ }
+ if (inputs->count(src) != 0) {
+ return;
+ }
+
+ InputWithRefcount iwr;
+ iwr.input = create_input(src);
+ if (iwr.input == NULL) {
+ log(ERROR, "did not understand URL '%s', clients will not get any data.",
+ src.c_str());
+ return;
+ }
+ iwr.refcount = 0;
+ inputs->insert(make_pair(src, iwr));
+}
+
// Find all streams in the configuration file, and create inputs for them.
void create_config_inputs(const Config &config, multimap<string, InputWithRefcount> *inputs)
{
for (unsigned i = 0; i < config.streams.size(); ++i) {
const StreamConfig &stream_config = config.streams[i];
- if (stream_config.src.empty()) {
- continue;
- }
-
- string src = stream_config.src;
- if (inputs->count(src) != 0) {
- continue;
- }
-
- InputWithRefcount iwr;
- iwr.input = create_input(src);
- if (iwr.input == NULL) {
- log(ERROR, "did not understand URL '%s', clients will not get any data.",
- src.c_str());
- continue;
- }
- iwr.refcount = 0;
- inputs->insert(make_pair(src, iwr));
+ create_config_input(stream_config.src, inputs);
+ }
+ for (unsigned i = 0; i < config.udpstreams.size(); ++i) {
+ const UDPStreamConfig &udpstream_config = config.udpstreams[i];
+ create_config_input(udpstream_config.src, inputs);
}
}
mark_pools.push_back(new MarkPool(mp_config.from, mp_config.to));
}
+ // HTTP streams.
set<string> expecting_urls = deserialized_urls;
for (unsigned i = 0; i < config.streams.size(); ++i) {
const StreamConfig &stream_config = config.streams[i];
}
}
- // Warn about any servers we've lost.
+ // Warn about any HTTP servers we've lost.
// TODO: Make an option (delete=yes?) to actually shut down streams.
for (set<string>::const_iterator stream_it = expecting_urls.begin();
stream_it != expecting_urls.end();
"It will not be deleted, but clients will not get any new inputs.",
url.c_str());
}
+
+ // UDP streams.
+ for (unsigned i = 0; i < config.udpstreams.size(); ++i) {
+ const UDPStreamConfig &udpstream_config = config.udpstreams[i];
+ MarkPool *mark_pool = NULL;
+ if (udpstream_config.mark_pool != -1) {
+ mark_pool = mark_pools[udpstream_config.mark_pool];
+ }
+ int stream_index = servers->add_udpstream(udpstream_config.dst, mark_pool);
+
+ string src = udpstream_config.src;
+ if (!src.empty()) {
+ multimap<string, InputWithRefcount>::iterator input_it = inputs->find(src);
+ assert(input_it != inputs->end());
+ input_it->second.input->add_destination(stream_index);
+ ++input_it->second.refcount;
+ }
+ }
}
void open_logs(const vector<LogConfig> &log_destinations)