diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-09-20 13:00:38 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-09-20 13:00:38 +0000 |
commit | 3a245f13b07c9817db51e19cfeb56e814bc9a0e1 (patch) | |
tree | 0447ffc80b1cd2cb51d015a0619c3eeb7ec49f10 /src | |
parent | 12cb27ceaa50eae46891775ee207fc95a8a47aca (diff) | |
download | gnunet-3a245f13b07c9817db51e19cfeb56e814bc9a0e1.tar.gz gnunet-3a245f13b07c9817db51e19cfeb56e814bc9a0e1.zip |
fix for remote testing
Diffstat (limited to 'src')
-rw-r--r-- | src/testing/testing_group.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 84260924b..e43beecaf 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -365,7 +365,7 @@ struct PeerData | |||
365 | 365 | ||
366 | 366 | ||
367 | /** | 367 | /** |
368 | * Data we keep per host. | 368 | * Linked list of per-host data. |
369 | */ | 369 | */ |
370 | struct HostData | 370 | struct HostData |
371 | { | 371 | { |
@@ -509,12 +509,16 @@ struct GNUNET_TESTING_PeerGroup | |||
509 | void *notify_connection_cls; | 509 | void *notify_connection_cls; |
510 | 510 | ||
511 | /** | 511 | /** |
512 | * NULL-terminated array of information about | 512 | * Array of information about hosts. |
513 | * hosts. | ||
514 | */ | 513 | */ |
515 | struct HostData *hosts; | 514 | struct HostData *hosts; |
516 | 515 | ||
517 | /** | 516 | /** |
517 | * Number of hosts (size of HostData) | ||
518 | */ | ||
519 | unsigned int num_hosts; | ||
520 | |||
521 | /** | ||
518 | * Array of "total" peers. | 522 | * Array of "total" peers. |
519 | */ | 523 | */ |
520 | struct PeerData *peers; | 524 | struct PeerData *peers; |
@@ -3571,7 +3575,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
3571 | pg->peers = GNUNET_malloc (total * sizeof (struct PeerData)); | 3575 | pg->peers = GNUNET_malloc (total * sizeof (struct PeerData)); |
3572 | if (NULL != hostnames) | 3576 | if (NULL != hostnames) |
3573 | { | 3577 | { |
3574 | off = 2; | 3578 | off = 0; |
3575 | hostpos = hostnames; | 3579 | hostpos = hostnames; |
3576 | while (hostpos != NULL) | 3580 | while (hostpos != NULL) |
3577 | { | 3581 | { |
@@ -3585,21 +3589,21 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
3585 | while (hostpos != NULL) | 3589 | while (hostpos != NULL) |
3586 | { | 3590 | { |
3587 | pg->hosts[off].minport = LOW_PORT; | 3591 | pg->hosts[off].minport = LOW_PORT; |
3588 | off++; | ||
3589 | pg->hosts[off].hostname = GNUNET_strdup(hostpos->hostname); | 3592 | pg->hosts[off].hostname = GNUNET_strdup(hostpos->hostname); |
3590 | if (hostpos->username != NULL) | 3593 | if (hostpos->username != NULL) |
3591 | pg->hosts[off].username = GNUNET_strdup(hostpos->username); | 3594 | pg->hosts[off].username = GNUNET_strdup(hostpos->username); |
3592 | pg->hosts[off].sshport = hostpos->port; | 3595 | pg->hosts[off].sshport = hostpos->port; |
3593 | hostpos = hostpos->next; | 3596 | hostpos = hostpos->next; |
3597 | off++; | ||
3594 | } | 3598 | } |
3595 | 3599 | ||
3596 | if (off == 0) | 3600 | if (off == 0) |
3597 | { | 3601 | { |
3598 | GNUNET_free (pg->hosts); | ||
3599 | pg->hosts = NULL; | 3602 | pg->hosts = NULL; |
3600 | } | 3603 | } |
3601 | hostcnt = off; | 3604 | hostcnt = off; |
3602 | minport = 0; | 3605 | minport = 0; |
3606 | pg->num_hosts = off; | ||
3603 | 3607 | ||
3604 | #if NO_LL | 3608 | #if NO_LL |
3605 | off = 2; | 3609 | off = 2; |
@@ -4279,11 +4283,12 @@ GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, | |||
4279 | GNUNET_CONTAINER_multihashmap_destroy(pg->peers[off].blacklisted_peers); | 4283 | GNUNET_CONTAINER_multihashmap_destroy(pg->peers[off].blacklisted_peers); |
4280 | } | 4284 | } |
4281 | GNUNET_free (pg->peers); | 4285 | GNUNET_free (pg->peers); |
4282 | if (NULL != pg->hosts) | 4286 | for (off = 0; off < pg->num_hosts; off++) |
4283 | { | 4287 | { |
4284 | GNUNET_free (pg->hosts[0].hostname); | 4288 | GNUNET_free (pg->hosts[off].hostname); |
4285 | GNUNET_free (pg->hosts); | 4289 | GNUNET_free_non_null (pg->hosts[off].username); |
4286 | } | 4290 | } |
4291 | GNUNET_free_non_null (pg->hosts); | ||
4287 | GNUNET_free (pg); | 4292 | GNUNET_free (pg); |
4288 | } | 4293 | } |
4289 | 4294 | ||