Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
solved a bug in route:multi. routes to where not added. appeared after the killing...
authorquasar <quasar@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 14 Dec 2007 16:27:46 +0000 (16:27 +0000)
committerquasar <quasar@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 14 Dec 2007 16:27:46 +0000 (16:27 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5123 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/network.c
src/surf/surfxml_parse.c

index 948a55c..0f5a1b1 100644 (file)
@@ -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);
index 9bb8b4e..736792a 100644 (file)
@@ -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);