From e79e6d79eadc1afc13c1d63b0183304f8080db00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Filipovi=C4=8D?= Date: Tue, 12 Oct 2010 13:14:47 +0000 Subject: [PATCH] patched ALL query --- org.glite.lb.server/src/stats.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/org.glite.lb.server/src/stats.c b/org.glite.lb.server/src/stats.c index 41edb2e..96e7080 100644 --- a/org.glite.lb.server/src/stats.c +++ b/org.glite.lb.server/src/stats.c @@ -714,7 +714,7 @@ int edg_wll_StateRateServer( { edg_wll_Stats *stats = default_stats; /* XXX: hardcoded */ struct edg_wll_stats_group *g; - int i; + int i, shift; char *sig = NULL; int err; @@ -766,15 +766,19 @@ int edg_wll_StateRateServer( /* all groups */ *rates = (float*)malloc(stats->grpno * sizeof((*rates)[0])); *groups = (char**)malloc((stats->grpno+1) * sizeof((*groups)[0])); + shift = 0; for (i=0, g=stats->map; igrpno; i++) { - (*rates)[i] = 0; - (*groups)[i] = NULL; - if ((err = stateRateRequest(ctx, stats, g, from, to, &((*rates)[i]), res_from, res_to))) - continue; //TODO in fact breaks results here - (*groups)[i] = strdup(g->destination); + (*rates)[i-shift] = 0; + (*groups)[i-shift] = NULL; + if ((err = stateRateRequest(ctx, stats, g, from, to, &((*rates)[i-shift]), res_from, res_to))){ + shift++; + g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize); + continue; + } + (*groups)[i-shift] = strdup(g->destination); g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize); } - (*groups)[i] = NULL; + (*groups)[i-shift] = NULL; if (i == 0){ edg_wll_SetError(ctx,ENOENT,"no matching group"); free(*rates); *rates = NULL; @@ -948,7 +952,7 @@ int edg_wll_StateDurationFromToServer( struct edg_wll_stats_group *g; char *sig = NULL; int err; - int i; + int i, shift; edg_wll_ResetError(ctx); *durations = NULL; @@ -1001,17 +1005,21 @@ int edg_wll_StateDurationFromToServer( *durations = (float*)malloc(stats->grpno * sizeof((*durations)[0])); *dispersions = (float*)malloc(stats->grpno * sizeof((*dispersions)[0])); *groups = (char**)malloc((stats->grpno+1) * sizeof((*groups)[0])); + shift = 0; for (i=0, g=stats->map; igrpno; i++) { - (*durations)[i] = 0; - (*dispersions)[i] = 0; - (*groups)[i] = NULL; - if ((err = stateDurationFromToRequest(ctx, stats, g, from, to, &((*durations)[i]), &((*dispersions)[i]), res_from, res_to))) - continue; //TODO in fact breaks results here - (*groups)[i] = strdup(g->destination); + (*durations)[i-shift] = 0; + (*dispersions)[i-shift] = 0; + (*groups)[i-shift] = NULL; + if ((err = stateDurationFromToRequest(ctx, stats, g, from, to, &((*durations)[i-shift]), &((*dispersions)[i-shift]), res_from, res_to))){ + shift++; + g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize); + continue; + } + (*groups)[i-shift] = strdup(g->destination); g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize); } - (*groups)[i] = NULL; + (*groups)[i-shift] = NULL; if (i == 0){ edg_wll_SetError(ctx,ENOENT,"no matching group"); free(*durations); *durations = NULL; -- 1.8.2.3