aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-07-30 14:43:10 +0000
committerNathan S. Evans <evans@in.tum.de>2010-07-30 14:43:10 +0000
commit6e2094bba704a47a24b60cfc8656f597b8d17a50 (patch)
tree4e2d630d68d942f50e69a87215bd9d59e063d9c5 /src
parentdf381b2e92568aed1d7ac2881e89c9ad169cb2eb (diff)
downloadgnunet-6e2094bba704a47a24b60cfc8656f597b8d17a50.tar.gz
gnunet-6e2094bba704a47a24b60cfc8656f597b8d17a50.zip
change from host as char * list to linked list
Diffstat (limited to 'src')
-rw-r--r--src/testing/testing_group.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 78100e446..7c90d6327 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -2975,8 +2975,8 @@ GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg)
2975 * @param cb_cls closure for cb 2975 * @param cb_cls closure for cb
2976 * @param connect_callback function to call each time two hosts are connected 2976 * @param connect_callback function to call each time two hosts are connected
2977 * @param connect_callback_cls closure for connect_callback 2977 * @param connect_callback_cls closure for connect_callback
2978 * @param hostnames space-separated list of hostnames to use; can be NULL (to run 2978 * @param hostnames linked list of hosts to use to start peers on (NULL to run on localhost only)
2979 * everything on localhost). 2979 *
2980 * @return NULL on error, otherwise handle to control peer group 2980 * @return NULL on error, otherwise handle to control peer group
2981 */ 2981 */
2982struct GNUNET_TESTING_PeerGroup * 2982struct GNUNET_TESTING_PeerGroup *
@@ -2990,12 +2990,15 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
2990 void *cb_cls, 2990 void *cb_cls,
2991 GNUNET_TESTING_NotifyConnection 2991 GNUNET_TESTING_NotifyConnection
2992 connect_callback, void *connect_callback_cls, 2992 connect_callback, void *connect_callback_cls,
2993 const char *hostnames) 2993 const struct GNUNET_TESTING_Host *hostnames)
2994{ 2994{
2995 struct GNUNET_TESTING_PeerGroup *pg; 2995 struct GNUNET_TESTING_PeerGroup *pg;
2996 const char *rpos; 2996 const struct GNUNET_TESTING_Host *hostpos;
2997#if 0
2997 char *pos; 2998 char *pos;
2999 const char *rpos;
2998 char *start; 3000 char *start;
3001#endif
2999 const char *hostname; 3002 const char *hostname;
3000 char *baseservicehome; 3003 char *baseservicehome;
3001 char *newservicehome; 3004 char *newservicehome;
@@ -3023,6 +3026,33 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
3023 if (NULL != hostnames) 3026 if (NULL != hostnames)
3024 { 3027 {
3025 off = 2; 3028 off = 2;
3029 hostpos = hostnames;
3030 while (hostpos != NULL)
3031 {
3032 hostpos = hostpos->next;
3033 off++;
3034 }
3035 pg->hosts = GNUNET_malloc (off * sizeof (struct HostData));
3036 off = 0;
3037
3038 hostpos = hostnames;
3039 while (hostpos != NULL)
3040 {
3041 pg->hosts[off].minport = LOW_PORT;
3042 pg->hosts[off++].hostname = GNUNET_strdup(hostpos->hostname);
3043 hostpos = hostpos->next;
3044 }
3045
3046 if (off == 0)
3047 {
3048 GNUNET_free (pg->hosts);
3049 pg->hosts = NULL;
3050 }
3051 hostcnt = off;
3052 minport = 0;
3053
3054#if NO_LL
3055 off = 2;
3026 /* skip leading spaces */ 3056 /* skip leading spaces */
3027 while ((0 != *hostnames) && (isspace ( (unsigned char) *hostnames))) 3057 while ((0 != *hostnames) && (isspace ( (unsigned char) *hostnames)))
3028 hostnames++; 3058 hostnames++;
@@ -3064,6 +3094,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
3064 } 3094 }
3065 hostcnt = off; 3095 hostcnt = off;
3066 minport = 0; /* make gcc happy */ 3096 minport = 0; /* make gcc happy */
3097#endif
3067 } 3098 }
3068 else 3099 else
3069 { 3100 {