X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=blobdiff_plain;f=drl%2Fconfig.c;h=65d8eb953037646b0dd161879ecf1f9c00863483;hp=1c56ce89275a34375d05310e332e152516cfa12e;hb=f83340496f632165030cc92cd98408a87082f6b1;hpb=74f52acf84cbf11faab8aa53e069464063ce11b9 diff --git a/drl/config.c b/drl/config.c index 1c56ce8..65d8eb9 100644 --- a/drl/config.c +++ b/drl/config.c @@ -105,7 +105,8 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) { xmlChar *branch; xmlChar *accounting; xmlChar *ewma; - xmlChar *intervals; + xmlChar *mainloop_intervals; + xmlChar *communication_intervals; xmlNodePtr fields = ident->children; ident_peer *current = NULL; @@ -168,6 +169,8 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) { common->accounting = ACT_SAMPLEHOLD; } else if (!xmlStrcmp(accounting, (const xmlChar *) "SIMPLE")) { common->accounting = ACT_SIMPLE; + } else if (!xmlStrcmp(accounting, (const xmlChar *) "MULTIPLEINTERVAL")) { + common->accounting = ACT_MULTIPLE; } else { printlog(LOG_CRITICAL, "Unknown/invalid accounting table.\n"); xmlFree(accounting); @@ -185,13 +188,22 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) { xmlFree(ewma); } - intervals = xmlGetProp(ident, (const xmlChar *) "intervals"); - if (intervals == NULL) { - printlog(LOG_CRITICAL, "Ident missing interval count.\n"); - return EINVAL; + mainloop_intervals = xmlGetProp(ident, (const xmlChar *) "loop_intervals"); + if (mainloop_intervals == NULL) { + printlog(LOG_WARN, "Ident id: %d missing loop_intervals, assuming 1.\n", common->id); + common->mainloop_intervals = 1; + } else { + common->mainloop_intervals = atoi((const char *) mainloop_intervals); + xmlFree(mainloop_intervals); + } + + communication_intervals = xmlGetProp(ident, (const xmlChar *) "comm_intervals"); + if (communication_intervals == NULL) { + printlog(LOG_WARN, "Ident id: %d missing comm_intervals, assuming 1.\n", common->id); + common->communication_intervals = 1; } else { - common->intervals = atoi((const char *) intervals); - xmlFree(intervals); + common->communication_intervals = atoi((const char *) communication_intervals); + xmlFree(communication_intervals); } while (fields != NULL) {