Long-outstanding commit. (Hopefully) Final version before running experiments for...
[distributedratelimiting.git] / drl / config.c
index 65d8eb9..42f4472 100644 (file)
@@ -79,10 +79,13 @@ int get_eligible_leaves(drl_instance_t *instance) {
 
         return ENOMEM;
     }
+    memset(leaves, 0, count * sizeof(leaf_t));
 
     for (i = 0; i < count; ++i) {
         leaves[i].xid = atoi(names[i]->d_name);
         leaves[i].parent = NULL;
+        leaves[i].drop_prob = 0.0;
+        leaves[i].delay = 0;
         
         free(names[i]);
 
@@ -107,6 +110,7 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) {
     xmlChar *ewma;
     xmlChar *mainloop_intervals;
     xmlChar *communication_intervals;
+    xmlChar *independent;
     xmlNodePtr fields = ident->children;
     ident_peer *current = NULL;
 
@@ -206,6 +210,14 @@ static int parse_common(xmlDocPtr doc, xmlNodePtr ident, ident_config *common) {
         xmlFree(communication_intervals);
     }
 
+    independent = xmlGetProp(ident, (const xmlChar *) "independent");
+    if (independent == NULL) {
+        common->independent = 0;
+    } else {
+        common->independent = atoi((const char *) independent);
+        xmlFree(independent);
+    }
+
     while (fields != NULL) {
         if((!xmlStrcmp(fields->name, (const xmlChar *) "peer"))) {
             xmlChar *ip = xmlNodeListGetString(doc, fields->children, 1);