X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/70fe1bef83c75e436e2085c8cbb32ee401a1e273..b84bad24cc0d403e9773384376ecff7d360f8379:/src/surf/network.c diff --git a/src/surf/network.c b/src/surf/network.c index a5edbe0512..c5b61f6a68 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -25,11 +25,6 @@ int host_count = 0; double sg_tcp_gamma = 0.0; -static void link_free(void *nw_link) -{ - xbt_dict_free(&(((link_CM02_t) nw_link)->properties)); - surf_resource_free(nw_link); -} static link_CM02_t link_new(char *name, double bw_initial, @@ -48,6 +43,7 @@ static link_CM02_t link_new(char *name, nw_link->generic_resource.model = surf_network_model; nw_link->generic_resource.name = name; + current_property_set = nw_link->generic_resource.properties = properties; nw_link->bw_current = bw_initial; if (bw_trace) nw_link->bw_event = @@ -68,11 +64,7 @@ static link_CM02_t link_new(char *name, if (policy == SURF_LINK_FATPIPE) lmm_constraint_shared(nw_link->constraint); - nw_link->properties = properties; - - current_property_set = properties; - - xbt_dict_set(surf_network_model->resource_set, name, nw_link, link_free); + xbt_dict_set(surf_network_model->resource_set, name, nw_link, surf_resource_free); return nw_link; } @@ -372,28 +364,15 @@ static surf_action_t communicate(const char *src_name, const char *dst_name,int "You're trying to send data from %s to %s but there is no connection between these two hosts.", src_name, dst_name); - action = xbt_new0(s_surf_action_network_CM02_t, 1); - - action->generic_action.refcount = 1; - action->generic_action.cost = size; - action->generic_action.remains = size; - action->generic_action.max_duration = NO_MAX_DURATION; - action->generic_action.start = surf_get_clock(); - action->generic_action.finish = -1.0; - action->generic_action.model_type = surf_network_model; - action->suspended = 0; /* Should be useless because of the - calloc but it seems to help valgrind... */ - action->generic_action.state_set = - surf_network_model->states.running_action_set; - link_CM02_t link; + int failed=0; xbt_dynar_foreach(route,i,link) { if (link->state_current == SURF_LINK_OFF) { - action->generic_action.state_set = - surf_network_model->states.failed_action_set; + failed = 1; break; } } + action = surf_action_new(sizeof(s_surf_action_network_CM02_t),size,surf_network_model,failed); xbt_swag_insert(action, action->generic_action.state_set); action->rate = rate; @@ -464,11 +443,6 @@ static int link_shared(const void *link) return lmm_constraint_is_shared(((link_CM02_t) link)->constraint); } -static xbt_dict_t get_properties(void *link) -{ - return ((link_CM02_t) link)->properties; -} - static void action_suspend(surf_action_t action) { ((surf_action_network_CM02_t) action)->suspended = 1; @@ -537,12 +511,10 @@ static void surf_network_model_init_internal(void) surf_network_model->extension.network.get_link_latency = get_link_latency; surf_network_model->extension.network.link_shared = link_shared; - surf_network_model->get_properties = get_properties; - if (!network_maxmin_system) network_maxmin_system = lmm_system_new(); - routing_model_full_create(sizeof(link_CM02_t), + routing_model_create(sizeof(link_CM02_t), link_new(xbt_strdup("__loopback__"), 498000000, NULL, 0.000015, NULL, SURF_LINK_ON, NULL, SURF_LINK_FATPIPE, NULL));