aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r--src/transport/transport-testing2.c67
1 files changed, 37 insertions, 30 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 1461915f0..789181d1f 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -328,6 +328,8 @@ notify_disconnect (void *cls,
328 } 328 }
329} 329}
330 330
331static void
332retrieve_hello (void *cls);
331 333
332static void 334static void
333hello_iter_cb (void *cb_cls, 335hello_iter_cb (void *cb_cls,
@@ -339,6 +341,12 @@ hello_iter_cb (void *cb_cls,
339 { 341 {
340 p->pic = NULL; 342 p->pic = NULL;
341 LOG (GNUNET_ERROR_TYPE_DEBUG, "Iteration End\n"); 343 LOG (GNUNET_ERROR_TYPE_DEBUG, "Iteration End\n");
344 if (NULL != p->start_cb)
345 {
346 LOG (GNUNET_ERROR_TYPE_DEBUG,
347 "Did not yet get my hello. Retrying...\n");
348 p->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, p);
349 }
342 return; 350 return;
343 } 351 }
344 // Check record type et al? 352 // Check record type et al?
@@ -536,12 +544,8 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct
536 // FIXME Error handling 544 // FIXME Error handling
537 p->ah = GNUNET_TRANSPORT_application_init (p->cfg); 545 p->ah = GNUNET_TRANSPORT_application_init (p->cfg);
538 GNUNET_assert (NULL != p->ah); 546 GNUNET_assert (NULL != p->ah);
539 // FIXME Error handleing 547 // FIXME Error handling
540 p->rh_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply ( 548 p->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, p);
541 GNUNET_TIME_UNIT_SECONDS, 10),
542 retrieve_hello,
543 p);
544 // GNUNET_assert (NULL != p->pic);
545 549
546 return p; 550 return p;
547} 551}
@@ -667,7 +671,7 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
667 } 671 }
668 if (NULL != p->pic) 672 if (NULL != p->pic)
669 { 673 {
670 // GNUNET_PEERSTORE_iterate_cancel (p->pic); 674 GNUNET_PEERSTORE_iterate_cancel (p->pic);
671 p->pic = NULL; 675 p->pic = NULL;
672 } 676 }
673 if (NULL != p->th) 677 if (NULL != p->th)
@@ -675,19 +679,6 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
675 GNUNET_TRANSPORT_core_disconnect (p->th); 679 GNUNET_TRANSPORT_core_disconnect (p->th);
676 p->th = NULL; 680 p->th = NULL;
677 } 681 }
678 if (NULL != p->peer)
679 {
680 if (GNUNET_OK !=
681 GNUNET_TESTING_peer_stop (p->peer))
682 {
683 LOG (GNUNET_ERROR_TYPE_DEBUG,
684 "Testing lib failed to stop peer %u (`%s')\n",
685 p->no,
686 GNUNET_i2s (&p->id));
687 }
688 GNUNET_TESTING_peer_destroy (p->peer);
689 p->peer = NULL;
690 }
691 if (NULL != p->ats) 682 if (NULL != p->ats)
692 { 683 {
693 GNUNET_ATS_connectivity_done (p->ats); 684 GNUNET_ATS_connectivity_done (p->ats);
@@ -700,9 +691,25 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
700 } 691 }
701 if (NULL != p->ph) 692 if (NULL != p->ph)
702 { 693 {
694 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
695 "Disconnecting from PEERSTORE service\n");
703 GNUNET_PEERSTORE_disconnect (p->ph, GNUNET_NO); 696 GNUNET_PEERSTORE_disconnect (p->ph, GNUNET_NO);
704 p->ph = NULL; 697 p->ph = NULL;
705 } 698 }
699
700 if (NULL != p->peer)
701 {
702 if (GNUNET_OK !=
703 GNUNET_TESTING_peer_stop (p->peer))
704 {
705 LOG (GNUNET_ERROR_TYPE_DEBUG,
706 "Testing lib failed to stop peer %u (`%s')\n",
707 p->no,
708 GNUNET_i2s (&p->id));
709 }
710 GNUNET_TESTING_peer_destroy (p->peer);
711 p->peer = NULL;
712 }
706 if (NULL != p->hello) 713 if (NULL != p->hello)
707 { 714 {
708 GNUNET_free (p->hello); 715 GNUNET_free (p->hello);
@@ -738,16 +745,16 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
738 * FIXME maybe schedule the application_validate somehow 745 * FIXME maybe schedule the application_validate somehow
739 */ 746 */
740/* 747/*
741static void 748 static void
742hello_offered (void *cls) 749 hello_offered (void *cls)
743{ 750 {
744 struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls; 751 struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls;
745 752
746 cc->oh = NULL; 753 cc->oh = NULL;
747 cc->tct = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 754 cc->tct = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
748 &offer_hello, 755 &offer_hello,
749 cc); 756 cc);
750}*/ 757 }*/
751 758
752 759
753/** 760/**