From 22f458ce4459c47599e68b1ac0e2033f044adb1b Mon Sep 17 00:00:00 2001 From: quasar Date: Fri, 14 Dec 2007 16:27:46 +0000 Subject: [PATCH] solved a bug in route:multi. routes to where not added. appeared after the killing of KCC... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5123 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/surf/network.c | 1 - src/surf/surfxml_parse.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/surf/network.c b/src/surf/network.c index 948a55ca24..0f5a1b18b6 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -218,7 +218,6 @@ static void add_route(void) src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16); dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16); - xbt_dynar_foreach (links, cpt, link) { TRY { link_list[nb_link++] = xbt_dict_get(link_set, link); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 9bb8b4e375..736792a912 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -855,7 +855,8 @@ static void convert_route_multi_to_routes(void) if (!route_multi_elements) return; xbt_dict_t set = cpu_set; - if (workstation_set != NULL) + DEBUG1("%d", xbt_dict_length(workstation_set)); + if (workstation_set != NULL && xbt_dict_length(workstation_set) > 0) set = workstation_set; @@ -880,18 +881,23 @@ static void convert_route_multi_to_routes(void) src_names = xbt_dynar_new(sizeof(char *), &free_string); val = xbt_strdup(src); xbt_dynar_push(src_names, &val); + if (strcmp(val,"$*") != 0 && NULL == xbt_dict_get_or_null(set, val)) + THROW3(unknown_error,0,"(In route:multi (%s -> %s) source %s does not exist (not a set or a host)", src, dst, src); } if (dst_names == NULL) { dst_names = xbt_dynar_new(sizeof(char *), &free_string); val = xbt_strdup(dst); + if (strcmp(val,"$*") != 0 && NULL == xbt_dict_get_or_null(set, val)) + THROW3(unknown_error,0,"(In route:multi (%s -> %s) destination %s does not exist (not a set or a host)", src, dst, dst); xbt_dynar_push(dst_names, &val); } + /* Build the routes */ DEBUG2("ADDING MULTI ROUTE: %s -> %s", xbt_dynar_get_as(keys, 0, char*), xbt_dynar_get_as(keys, 1, char*)); xbt_dynar_foreach(src_names, cpt, src_host_name) { xbt_dynar_foreach(dst_names, cpt2, dst_host_name) { /* If dst is $* then set this route to have its dst point to all hosts */ - if (strcmp(src_host_name,"$*") != 0 && strcmp(dst_host_name,"$*") == 0){ + if (strcmp(src_host_name,"$*") != 0 && strcmp(dst_host_name,"$*") == 0){ xbt_dict_foreach(set, cursor_w, key_w, data_w) { //int n = xbt_dynar_member(src_names, (char*)key_w); add_multi_links(src, dst, links, src_host_name, key_w); -- 2.20.1