From: Sree Harsha Totakura Date: Wed, 17 Oct 2012 15:26:13 +0000 (+0000) Subject: fixs for crash while adding slaves with id greater than 9 X-Git-Tag: initial-import-from-subversion-38251~11361 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=58a9e9e741a6ae984d1e8332f905eb0c6fa7bfb3;p=oweals%2Fgnunet.git fixs for crash while adding slaves with id greater than 9 --- diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 42a15c627..4b05eb378 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c @@ -996,13 +996,16 @@ route_list_add (struct Route *route) static void slave_list_add (struct Slave *slave) { + uint32_t orig_size; + + orig_size = slave_list_size; if (slave->host_id >= slave_list_size) { + while (slave->host_id >= slave_list_size) + slave_list_size += LIST_GROW_STEP; slave_list = - TESTBED_realloc (slave_list, sizeof (struct Slave *) * slave_list_size, - sizeof (struct Slave *) * (slave_list_size + - LIST_GROW_STEP)); - slave_list_size += LIST_GROW_STEP; + TESTBED_realloc (slave_list, sizeof (struct Slave *) * orig_size, + sizeof (struct Slave *) * slave_list_size); } GNUNET_assert (NULL == slave_list[slave->host_id]); slave_list[slave->host_id] = slave; diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 7b4218890..fd4f3885e 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c @@ -452,13 +452,16 @@ controller_event_cb (void *cls, static unsigned int established_links; if (0 == established_links) - printf ("Establishing links\n"); + printf ("Establishing links\n ."); else + { printf ("."); + fflush (stdout); + } if (++established_links == num_links) { prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); - printf ("%u links established in %.2f seconds\n", + printf ("\n%u links established in %.2f seconds\n", num_links, ((double) prof_time.rel_value) / 1000.00); result = GNUNET_OK; GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);