diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-17 15:26:13 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-17 15:26:13 +0000 |
commit | 58a9e9e741a6ae984d1e8332f905eb0c6fa7bfb3 (patch) | |
tree | 201bf1cb1aa7096c47594c96948a9e01411341ee /src/testbed | |
parent | 98353d5eef5165351ce9e3d0e20778aa8bdcac5b (diff) | |
download | gnunet-58a9e9e741a6ae984d1e8332f905eb0c6fa7bfb3.tar.gz gnunet-58a9e9e741a6ae984d1e8332f905eb0c6fa7bfb3.zip |
fixs for crash while adding slaves with id greater than 9
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 11 | ||||
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 7 |
2 files changed, 12 insertions, 6 deletions
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) | |||
996 | static void | 996 | static void |
997 | slave_list_add (struct Slave *slave) | 997 | slave_list_add (struct Slave *slave) |
998 | { | 998 | { |
999 | uint32_t orig_size; | ||
1000 | |||
1001 | orig_size = slave_list_size; | ||
999 | if (slave->host_id >= slave_list_size) | 1002 | if (slave->host_id >= slave_list_size) |
1000 | { | 1003 | { |
1004 | while (slave->host_id >= slave_list_size) | ||
1005 | slave_list_size += LIST_GROW_STEP; | ||
1001 | slave_list = | 1006 | slave_list = |
1002 | TESTBED_realloc (slave_list, sizeof (struct Slave *) * slave_list_size, | 1007 | TESTBED_realloc (slave_list, sizeof (struct Slave *) * orig_size, |
1003 | sizeof (struct Slave *) * (slave_list_size + | 1008 | sizeof (struct Slave *) * slave_list_size); |
1004 | LIST_GROW_STEP)); | ||
1005 | slave_list_size += LIST_GROW_STEP; | ||
1006 | } | 1009 | } |
1007 | GNUNET_assert (NULL == slave_list[slave->host_id]); | 1010 | GNUNET_assert (NULL == slave_list[slave->host_id]); |
1008 | slave_list[slave->host_id] = slave; | 1011 | 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, | |||
452 | static unsigned int established_links; | 452 | static unsigned int established_links; |
453 | 453 | ||
454 | if (0 == established_links) | 454 | if (0 == established_links) |
455 | printf ("Establishing links\n"); | 455 | printf ("Establishing links\n ."); |
456 | else | 456 | else |
457 | { | ||
457 | printf ("."); | 458 | printf ("."); |
459 | fflush (stdout); | ||
460 | } | ||
458 | if (++established_links == num_links) | 461 | if (++established_links == num_links) |
459 | { | 462 | { |
460 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); | 463 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); |
461 | printf ("%u links established in %.2f seconds\n", | 464 | printf ("\n%u links established in %.2f seconds\n", |
462 | num_links, ((double) prof_time.rel_value) / 1000.00); | 465 | num_links, ((double) prof_time.rel_value) / 1000.00); |
463 | result = GNUNET_OK; | 466 | result = GNUNET_OK; |
464 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 467 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |