aboutsummaryrefslogtreecommitdiff
path: root/src/fs/perf_gnunet_service_fs_p2p_respect.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-02-01 08:48:47 +0000
committerChristian Grothoff <christian@grothoff.org>2013-02-01 08:48:47 +0000
commit309276a88d1e57dffbea0014dc0708726c2e9376 (patch)
tree285ffccfe3cf9f69c7f3f537d80e473e8f087cc9 /src/fs/perf_gnunet_service_fs_p2p_respect.c
parent4785f9c53cad18c14a20e9341b86b97f1021a574 (diff)
downloadgnunet-309276a88d1e57dffbea0014dc0708726c2e9376.tar.gz
gnunet-309276a88d1e57dffbea0014dc0708726c2e9376.zip
-fix non-terminating index test --- do not remove file early
Diffstat (limited to 'src/fs/perf_gnunet_service_fs_p2p_respect.c')
-rw-r--r--src/fs/perf_gnunet_service_fs_p2p_respect.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/fs/perf_gnunet_service_fs_p2p_respect.c b/src/fs/perf_gnunet_service_fs_p2p_respect.c
index 11fb0b540..0a5dc0578 100644
--- a/src/fs/perf_gnunet_service_fs_p2p_respect.c
+++ b/src/fs/perf_gnunet_service_fs_p2p_respect.c
@@ -86,6 +86,9 @@ static struct GNUNET_FS_Uri *uri1;
86 86
87static struct GNUNET_FS_Uri *uri2; 87static struct GNUNET_FS_Uri *uri2;
88 88
89static char *fn1;
90
91static char *fn2;
89 92
90/** 93/**
91 * Master context for 'stat_run'. 94 * Master context for 'stat_run'.
@@ -132,6 +135,23 @@ static struct StatValues stats[] = {
132}; 135};
133 136
134 137
138static void
139cleanup ()
140{
141 GNUNET_SCHEDULER_shutdown ();
142 if (NULL != fn1)
143 {
144 GNUNET_DISK_directory_remove (fn1);
145 GNUNET_free (fn1);
146 }
147 if (NULL != fn2)
148 {
149 GNUNET_DISK_directory_remove (fn2);
150 GNUNET_free (fn2);
151 }
152}
153
154
135/** 155/**
136 * Callback function to process statistic values. 156 * Callback function to process statistic values.
137 * 157 *
@@ -244,7 +264,7 @@ stat_run (void *cls,
244 if (NUM_DAEMONS == sm->daemon) 264 if (NUM_DAEMONS == sm->daemon)
245 { 265 {
246 GNUNET_free (sm); 266 GNUNET_free (sm);
247 GNUNET_SCHEDULER_shutdown (); 267 cleanup ();
248 return; 268 return;
249 } 269 }
250 sm->op = 270 sm->op =
@@ -273,7 +293,7 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
273 "Timeout during download for type `%s', shutting down with error\n", 293 "Timeout during download for type `%s', shutting down with error\n",
274 type); 294 type);
275 ok = 1; 295 ok = 1;
276 GNUNET_SCHEDULER_shutdown (); 296 cleanup ();
277 return; 297 return;
278 } 298 }
279 del = GNUNET_TIME_absolute_get_duration (start_time); 299 del = GNUNET_TIME_absolute_get_duration (start_time);
@@ -301,19 +321,22 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
301 321
302 322
303static void 323static void
304do_downloads (void *cls, const struct GNUNET_FS_Uri *u2) 324do_downloads (void *cls, const struct GNUNET_FS_Uri *u2,
325 const char *fn)
305{ 326{
306 int anonymity; 327 int anonymity;
307 unsigned int i; 328 unsigned int i;
308 329
309 if (NULL == u2) 330 if (NULL == u2)
310 { 331 {
311 GNUNET_SCHEDULER_shutdown (); 332 cleanup ();
312 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
313 "Timeout during upload attempt, shutting down with error\n"); 334 "Timeout during upload attempt, shutting down with error\n");
314 ok = 1; 335 ok = 1;
315 return; 336 return;
316 } 337 }
338 if (NULL != fn)
339 fn2 = GNUNET_strdup (fn);
317 uri2 = GNUNET_FS_uri_dup (u2); 340 uri2 = GNUNET_FS_uri_dup (u2);
318 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Downloading %llu bytes\n", 341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Downloading %llu bytes\n",
319 (unsigned long long) FILESIZE); 342 (unsigned long long) FILESIZE);
@@ -340,19 +363,22 @@ do_downloads (void *cls, const struct GNUNET_FS_Uri *u2)
340 363
341static void 364static void
342do_publish2 (void *cls, 365do_publish2 (void *cls,
343 const struct GNUNET_FS_Uri *u1) 366 const struct GNUNET_FS_Uri *u1,
367 const char *fn)
344{ 368{
345 int do_index; 369 int do_index;
346 int anonymity; 370 int anonymity;
347 371
348 if (NULL == u1) 372 if (NULL == u1)
349 { 373 {
350 GNUNET_SCHEDULER_shutdown (); 374 cleanup ();
351 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 375 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
352 "Timeout during upload attempt, shutting down with error\n"); 376 "Timeout during upload attempt, shutting down with error\n");
353 ok = 1; 377 ok = 1;
354 return; 378 return;
355 } 379 }
380 if (NULL != fn)
381 fn1 = GNUNET_strdup (fn);
356 uri1 = GNUNET_FS_uri_dup (u1); 382 uri1 = GNUNET_FS_uri_dup (u1);
357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Publishing %llu bytes\n", 383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Publishing %llu bytes\n",
358 (unsigned long long) FILESIZE); 384 (unsigned long long) FILESIZE);
@@ -383,7 +409,7 @@ do_publish1 (void *cls,
383 GNUNET_TESTBED_operation_done (op); 409 GNUNET_TESTBED_operation_done (op);
384 if (NULL != emsg) 410 if (NULL != emsg)
385 { 411 {
386 GNUNET_SCHEDULER_shutdown (); 412 cleanup ();
387 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error trying to connect: %s\n", emsg); 413 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error trying to connect: %s\n", emsg);
388 ok = 1; 414 ok = 1;
389 return; 415 return;