X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/45c3f1cfee86fb48c96d53f8267f99b6db6e3d7a..40778ac106dfafd9f790d8bdadf737de01c3d3e3:/src/surf/surf_routing_full.cpp?ds=sidebyside diff --git a/src/surf/surf_routing_full.cpp b/src/surf/surf_routing_full.cpp index 4c0aeb0359..4c74df4d96 100644 --- a/src/surf/surf_routing_full.cpp +++ b/src/surf/surf_routing_full.cpp @@ -54,22 +54,24 @@ AsFull::AsFull(){ } AsFull::~AsFull(){ - int table_size = (int)xbt_dynar_length(p_indexNetworkElm); - int i, j; - /* Delete routing table */ - for (i = 0; i < table_size; i++) - for (j = 0; j < table_size; j++) { - if (TO_ROUTE_FULL(i,j)){ - xbt_dynar_free(&TO_ROUTE_FULL(i,j)->link_list); - xbt_free(TO_ROUTE_FULL(i,j)); + if (p_routingTable) { + int table_size = (int)xbt_dynar_length(p_indexNetworkElm); + int i, j; + /* Delete routing table */ + for (i = 0; i < table_size; i++) + for (j = 0; j < table_size; j++) { + if (TO_ROUTE_FULL(i,j)){ + xbt_dynar_free(&TO_ROUTE_FULL(i,j)->link_list); + xbt_free(TO_ROUTE_FULL(i,j)); + } } - } - xbt_free(p_routingTable); + xbt_free(p_routingTable); + } } xbt_dynar_t AsFull::getOneLinkRoutes() { - xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free); + xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f); int src, dst; int table_size = xbt_dynar_length(p_indexNetworkElm); @@ -182,7 +184,7 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route) "between \"%s\" and \"%s\"", src, dst); } } else { - if (!route->gw_dst && !route->gw_dst) + if (!route->gw_src && !route->gw_dst) XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst); else { // FIXME We can call a gw which is down the current AS (cf g5k.xml) but not upper. @@ -212,12 +214,17 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route) // "but '%s' is not in '%s'.", // route->dst_gateway, subas->name); as_route = 1; - XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", - src, route->gw_src->getName(), dst, route->gw_dst->getName()); - if (route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL) - xbt_die("The dst_gateway '%s' does not exist!", route->gw_dst->getName()); - if (route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL) - xbt_die("The src_gateway '%s' does not exist!", route->gw_src->getName()); + XBT_DEBUG("Load ASroute from \"%s\" to \"%s\"", src, dst); + if (!route->gw_src || + route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL) + surf_parse_error("The src_gateway \"%s\" does not exist!", + route->gw_src ? route->gw_src->getName() : "(null)"); + if (!route->gw_dst || + route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL) + surf_parse_error("The dst_gateway \"%s\" does not exist!", + route->gw_dst ? route->gw_dst->getName() : "(null)"); + XBT_DEBUG("ASroute goes from \"%s\" to \"%s\"", + route->gw_src->getName(), route->gw_dst->getName()); } TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId()) = newExtendedRoute(p_hierarchy, route, 1); xbt_dynar_shrink(TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId())->link_list, 0);