X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/39b6ed28636c4d67a0127d8526bf10dbc212cdc9..b380659d4cf88b049bfac7e75780a0cff8ae7b5d:/src/surf/surf_routing.c diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 2f2c37583d..8794bbcc30 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -809,6 +809,26 @@ static xbt_dynar_t get_route(const char *src, const char *dst) return route; } +/** + * \brief Generic method: find a route between hosts + * + * \param src the source host name + * \param dst the destination host name + * + * same as get_route, but return NULL if any exception is raised. + */ +static xbt_dynar_t get_route_or_null(const char *src, const char *dst) +{ + xbt_dynar_t route = NULL; + xbt_ex_t exception; + TRY { + get_route_latency(src, dst, &route, NULL, 1); + }CATCH(exception) { + return NULL; + } + return route; +} + /** * \brief Generic method: find a route between hosts * @@ -935,6 +955,7 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ global_routing = xbt_new0(s_routing_global_t, 1); global_routing->root = NULL; global_routing->get_route = get_route; + global_routing->get_route_or_null = get_route_or_null; global_routing->get_latency = get_latency; global_routing->get_route_no_cleanup = get_route_no_cleanup; global_routing->get_onelink_routes = get_onelink_routes; @@ -1507,7 +1528,7 @@ void routing_parse_Scluster(void) char *cluster_availability_file = A_surfxml_cluster_availability_file; char *cluster_state_file = A_surfxml_cluster_state_file; char *host_id, *groups, *link_id = NULL; - char *router_id; + char *router_id = xbt_strdup(A_surfxml_cluster_router_id); char *availability_file = xbt_strdup(cluster_availability_file); char *state_file = xbt_strdup(cluster_state_file); @@ -1686,9 +1707,8 @@ void routing_parse_Scluster(void) xbt_dynar_free(&radical_elements); XBT_DEBUG(" "); - router_id = - bprintf("%s%s_router%s", cluster_prefix, cluster_id, - cluster_suffix); + if(!strcmp(router_id,"")) + router_id = bprintf("%s%s_router%s", cluster_prefix, cluster_id, cluster_suffix); XBT_DEBUG("", router_id); SURFXML_BUFFER_SET(router_id, router_id);