aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_test_lib.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-05 21:18:45 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-05 21:18:45 +0000
commit563b71afee70ac213a8bb28ce0697fcbae06aac3 (patch)
tree122d6a25630f68a9845651ba2295ef68f7d2af09 /src/fs/fs_test_lib.c
parentcf6e2bdb1b9a5aedc4f090df853814b9df817e03 (diff)
downloadgnunet-563b71afee70ac213a8bb28ce0697fcbae06aac3.tar.gz
gnunet-563b71afee70ac213a8bb28ce0697fcbae06aac3.zip
fixing API and clean up issues in testing
Diffstat (limited to 'src/fs/fs_test_lib.c')
-rw-r--r--src/fs/fs_test_lib.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index 17291d1bd..40a9f6276 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -379,10 +379,11 @@ GNUNET_FS_TEST_daemons_start (const char *template_cfg_file,
379} 379}
380 380
381 381
382struct ConnectContext 382struct GNUNET_FS_TEST_ConnectContext
383{ 383{
384 GNUNET_SCHEDULER_Task cont; 384 GNUNET_SCHEDULER_Task cont;
385 void *cont_cls; 385 void *cont_cls;
386 struct GNUNET_TESTING_ConnectContext *cc;
386}; 387};
387 388
388 389
@@ -409,8 +410,9 @@ notify_connection (void *cls, const struct GNUNET_PeerIdentity *first,
409 struct GNUNET_TESTING_Daemon *second_daemon, 410 struct GNUNET_TESTING_Daemon *second_daemon,
410 const char *emsg) 411 const char *emsg)
411{ 412{
412 struct ConnectContext *cc = cls; 413 struct GNUNET_FS_TEST_ConnectContext *cc = cls;
413 414
415 cc->cc = NULL;
414 if (emsg != NULL) 416 if (emsg != NULL)
415 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to connect peers: %s\n", 417 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to connect peers: %s\n",
416 emsg); 418 emsg);
@@ -432,20 +434,34 @@ notify_connection (void *cls, const struct GNUNET_PeerIdentity *first,
432 * @param cont function to call when done 434 * @param cont function to call when done
433 * @param cont_cls closure for cont 435 * @param cont_cls closure for cont
434 */ 436 */
435void 437struct GNUNET_FS_TEST_ConnectContext *
436GNUNET_FS_TEST_daemons_connect (struct GNUNET_FS_TestDaemon *daemon1, 438GNUNET_FS_TEST_daemons_connect (struct GNUNET_FS_TestDaemon *daemon1,
437 struct GNUNET_FS_TestDaemon *daemon2, 439 struct GNUNET_FS_TestDaemon *daemon2,
438 struct GNUNET_TIME_Relative timeout, 440 struct GNUNET_TIME_Relative timeout,
439 GNUNET_SCHEDULER_Task cont, void *cont_cls) 441 GNUNET_SCHEDULER_Task cont, void *cont_cls)
440{ 442{
441 struct ConnectContext *ncc; 443 struct GNUNET_FS_TEST_ConnectContext *ncc;
442 444
443 ncc = GNUNET_malloc (sizeof (struct ConnectContext)); 445 ncc = GNUNET_malloc (sizeof (struct GNUNET_FS_TEST_ConnectContext));
444 ncc->cont = cont; 446 ncc->cont = cont;
445 ncc->cont_cls = cont_cls; 447 ncc->cont_cls = cont_cls;
446 GNUNET_TESTING_daemons_connect (daemon1->daemon, daemon2->daemon, timeout, 448 ncc->cc = GNUNET_TESTING_daemons_connect (daemon1->daemon, daemon2->daemon, timeout,
447 CONNECT_ATTEMPTS, GNUNET_YES, 449 CONNECT_ATTEMPTS, GNUNET_YES,
448 &notify_connection, ncc); 450 &notify_connection, ncc);
451 return ncc;
452}
453
454
455/**
456 * Cancel connect operation.
457 *
458 * @param cc operation to cancel
459 */
460void
461GNUNET_FS_TEST_daemons_connect_cancel (struct GNUNET_FS_TEST_ConnectContext *cc)
462{
463 GNUNET_TESTING_daemons_connect_cancel (cc->cc);
464 GNUNET_free (cc);
449} 465}
450 466
451 467