X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=config.cpp;h=f5182aac1512e9b8307ac57d16ada0b639260257;hb=ce0d42a14da5686366d0c73fa9b152e90619ff91;hp=d47bfec0fbb72fc4fe668939805ad54d7249d861;hpb=adbeb2f8972672ed1059509662d006df47762228;p=cubemap diff --git a/config.cpp b/config.cpp index d47bfec..f5182aa 100644 --- a/config.cpp +++ b/config.cpp @@ -1,8 +1,11 @@ +#include #include #include +#include #include #include #include +#include #include #include #include @@ -231,6 +234,14 @@ bool parse_stream(const ConfigLine &line, Config *config) stream.mark_pool = allocate_mark_pool(from, to, config); } + // Parse the pacing rate, converting from kilobits to bytes as needed. + map::const_iterator pacing_rate_it = line.parameters.find("pacing_rate_kbit"); + if (pacing_rate_it == line.parameters.end()) { + stream.pacing_rate = ~0U; + } else { + stream.pacing_rate = atoi(pacing_rate_it->second.c_str()) * 1024 / 8; + } + config->streams.push_back(stream); return true; } @@ -313,9 +324,18 @@ bool parse_udpstream(const ConfigLine &line, Config *config) udpstream.mark_pool = allocate_mark_pool(from, to, config); } + // Parse the pacing rate, converting from kilobits to bytes as needed. + map::const_iterator pacing_rate_it = line.parameters.find("pacing_rate_kbit"); + if (pacing_rate_it == line.parameters.end()) { + udpstream.pacing_rate = ~0U; + } else { + udpstream.pacing_rate = atoi(pacing_rate_it->second.c_str()) * 1024 / 8; + } + config->udpstreams.push_back(udpstream); return true; } + bool parse_error_log(const ConfigLine &line, Config *config) { if (line.arguments.size() != 0) { @@ -378,7 +398,14 @@ bool parse_config(const string &filename, Config *config) bool has_stats_file = fetch_config_string(lines, "stats_file", &config->stats_file); bool has_stats_interval = fetch_config_int(lines, "stats_interval", &config->stats_interval); if (has_stats_interval && !has_stats_file) { - log(WARNING, "'stats_interval' given, but no 'stats_file'. No statistics will be written."); + log(WARNING, "'stats_interval' given, but no 'stats_file'. No client statistics will be written."); + } + + config->input_stats_interval = 60; + bool has_input_stats_file = fetch_config_string(lines, "input_stats_file", &config->input_stats_file); + bool has_input_stats_interval = fetch_config_int(lines, "input_stats_interval", &config->input_stats_interval); + if (has_input_stats_interval && !has_input_stats_file) { + log(WARNING, "'input_stats_interval' given, but no 'input_stats_file'. No input statistics will be written."); } fetch_config_string(lines, "access_log", &config->access_log_file); @@ -388,6 +415,8 @@ bool parse_config(const string &filename, Config *config) if (line.keyword == "num_servers" || line.keyword == "stats_file" || line.keyword == "stats_interval" || + line.keyword == "input_stats_file" || + line.keyword == "input_stats_interval" || line.keyword == "access_log") { // Already taken care of, above. } else if (line.keyword == "port") {