diff options
Diffstat (limited to 'src/testing/test_testing_group_remote.c')
-rw-r--r-- | src/testing/test_testing_group_remote.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/testing/test_testing_group_remote.c b/src/testing/test_testing_group_remote.c index a58a1234e..a0ef63847 100644 --- a/src/testing/test_testing_group_remote.c +++ b/src/testing/test_testing_group_remote.c | |||
@@ -88,13 +88,13 @@ my_cb (void *cls, | |||
88 | peers_left--; | 88 | peers_left--; |
89 | if (peers_left == 0) | 89 | if (peers_left == 0) |
90 | { | 90 | { |
91 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 91 | //GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
92 | ok = 0; | 92 | ok = 0; |
93 | } | 93 | } |
94 | else if (peers_failed == peers_left) | 94 | else if (peers_failed == peers_left) |
95 | { | 95 | { |
96 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); | 96 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); |
97 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 97 | //GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
@@ -113,6 +113,7 @@ run (void *cls, | |||
113 | char *buf; | 113 | char *buf; |
114 | char *data; | 114 | char *data; |
115 | int count; | 115 | int count; |
116 | int ret; | ||
116 | sched = s; | 117 | sched = s; |
117 | ok = 1; | 118 | ok = 1; |
118 | #if VERBOSE | 119 | #if VERBOSE |
@@ -165,11 +166,27 @@ run (void *cls, | |||
165 | while (count < frstat.st_size) | 166 | while (count < frstat.st_size) |
166 | { | 167 | { |
167 | count++; | 168 | count++; |
168 | if (((data[count] == '\n') || (data[count] == '\0')) && (buf != &data[count])) | 169 | if (count >= frstat.st_size) |
170 | break; | ||
171 | |||
172 | /* if (((data[count] == '\n') || (data[count] == '\0')) && (buf != &data[count]))*/ | ||
173 | if (((data[count] == '\n')) && (buf != &data[count])) | ||
169 | { | 174 | { |
170 | data[count] = '\0'; | 175 | data[count] = '\0'; |
171 | temphost = GNUNET_malloc(sizeof(struct GNUNET_TESTING_Host)); | 176 | temphost = GNUNET_malloc(sizeof(struct GNUNET_TESTING_Host)); |
172 | temphost->hostname = buf; | 177 | ret = sscanf(buf, "%a[a-zA-Z0-9]@%a[a-zA-Z0-9.]:%hd", &temphost->username, &temphost->hostname, &temphost->port); |
178 | if (3 == ret) | ||
179 | { | ||
180 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Successfully read host %s, port %d and user %s from file\n", temphost->hostname, temphost->port, temphost->username); | ||
181 | } | ||
182 | else | ||
183 | { | ||
184 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Error reading line `%s' in hostfile\n", buf); | ||
185 | GNUNET_free(temphost); | ||
186 | buf = &data[count + 1]; | ||
187 | continue; | ||
188 | } | ||
189 | /* temphost->hostname = buf; */ | ||
173 | temphost->next = hosts; | 190 | temphost->next = hosts; |
174 | hosts = temphost; | 191 | hosts = temphost; |
175 | buf = &data[count + 1]; | 192 | buf = &data[count + 1]; |
@@ -195,11 +212,14 @@ run (void *cls, | |||
195 | while (hostpos != NULL) | 212 | while (hostpos != NULL) |
196 | { | 213 | { |
197 | temphost = hostpos->next; | 214 | temphost = hostpos->next; |
215 | GNUNET_free(hostpos->hostname); | ||
216 | GNUNET_free(hostpos->username); | ||
198 | GNUNET_free(hostpos); | 217 | GNUNET_free(hostpos); |
199 | hostpos = temphost; | 218 | hostpos = temphost; |
200 | } | 219 | } |
201 | GNUNET_free_non_null(data); | 220 | GNUNET_free_non_null(data); |
202 | GNUNET_assert (pg != NULL); | 221 | GNUNET_assert (pg != NULL); |
222 | |||
203 | } | 223 | } |
204 | 224 | ||
205 | static int | 225 | static int |