X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/563dc1eb8cddec3395e007bbd5e2ebc98893aa38..b380659d4cf88b049bfac7e75780a0cff8ae7b5d:/src/surf/surf_routing.c diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 184ce558eb..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;