aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed_oc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-service-testbed_oc.c')
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c61
1 files changed, 23 insertions, 38 deletions
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index 6bb4ec4fb..34bf8e047 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -362,12 +362,9 @@ GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc)
362 * Timeout task for cancelling a forwarded overlay connect connect 362 * Timeout task for cancelling a forwarded overlay connect connect
363 * 363 *
364 * @param cls the ForwardedOverlayConnectContext 364 * @param cls the ForwardedOverlayConnectContext
365 * @param tc the task context from the scheduler
366 */ 365 */
367static void 366static void
368forwarded_overlay_connect_timeout (void *cls, 367forwarded_overlay_connect_timeout (void *cls)
369 const struct GNUNET_SCHEDULER_TaskContext
370 *tc)
371{ 368{
372 struct ForwardedOperationContext *fopc = cls; 369 struct ForwardedOperationContext *fopc = cls;
373 struct RegisteredHostContext *rhc; 370 struct RegisteredHostContext *rhc;
@@ -379,7 +376,7 @@ forwarded_overlay_connect_timeout (void *cls,
379 LOG_DEBUG ("Overlay linking between peers %u and %u failed\n", focc->peer1, 376 LOG_DEBUG ("Overlay linking between peers %u and %u failed\n", focc->peer1,
380 focc->peer2); 377 focc->peer2);
381 GST_cleanup_focc (focc); 378 GST_cleanup_focc (focc);
382 GST_forwarded_operation_timeout (fopc, tc); 379 GST_forwarded_operation_timeout (fopc);
383 if (NULL != rhc->focc_dll_head) 380 if (NULL != rhc->focc_dll_head)
384 GST_process_next_focc (rhc); 381 GST_process_next_focc (rhc);
385} 382}
@@ -573,11 +570,9 @@ cleanup_occ (struct OverlayConnectContext *occ)
573 * Task for cleaing up overlay connect context structure 570 * Task for cleaing up overlay connect context structure
574 * 571 *
575 * @param cls the overlay connect context 572 * @param cls the overlay connect context
576 * @param tc the task context
577 */ 573 */
578static void 574static void
579do_cleanup_occ (void *cls, 575do_cleanup_occ (void *cls)
580 const struct GNUNET_SCHEDULER_TaskContext *tc)
581{ 576{
582 struct OverlayConnectContext *occ = cls; 577 struct OverlayConnectContext *occ = cls;
583 578
@@ -590,11 +585,9 @@ do_cleanup_occ (void *cls,
590 * Task which will be run when overlay connect request has been timed out 585 * Task which will be run when overlay connect request has been timed out
591 * 586 *
592 * @param cls the OverlayConnectContext 587 * @param cls the OverlayConnectContext
593 * @param tc the TaskContext
594 */ 588 */
595static void 589static void
596timeout_overlay_connect (void *cls, 590timeout_overlay_connect (void *cls)
597 const struct GNUNET_SCHEDULER_TaskContext *tc)
598{ 591{
599 struct OverlayConnectContext *occ = cls; 592 struct OverlayConnectContext *occ = cls;
600 593
@@ -777,29 +770,27 @@ occ_cache_get_handle_ats_rocc_cb (void *cls,
777 * peer 1. 770 * peer 1.
778 * 771 *
779 * @param cls the OverlayConnectContext 772 * @param cls the OverlayConnectContext
780 * @param tc the TaskContext from scheduler
781 */ 773 */
782static void 774static void
783send_hello (void *cls, 775send_hello (void *cls);
784 const struct GNUNET_SCHEDULER_TaskContext *tc);
785 776
786 777
787/** 778/**
788 * Task that is run when hello has been sent 779 * Task that is run when hello has been sent If tc->reason =
780 * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
781 * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
789 * 782 *
790 * @param cls the overlay connect context 783 * @param cls the overlay connect context
791 * @param tc the scheduler task context; if tc->reason =
792 * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
793 * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
794 */ 784 */
795static void 785static void
796occ_hello_sent_cb (void *cls, 786occ_hello_sent_cb (void *cls)
797 const struct GNUNET_SCHEDULER_TaskContext *tc)
798{ 787{
799 struct OverlayConnectContext *occ = cls; 788 struct OverlayConnectContext *occ = cls;
800 struct LocalPeer2Context *lp2c; 789 struct LocalPeer2Context *lp2c;
801 struct Peer *peer2; 790 struct Peer *peer2;
791 const struct GNUNET_SCHEDULER_TaskContext *tc;
802 792
793 tc = GNUNET_SCHEDULER_get_task_context ();
803 GNUNET_assert (OCC_TYPE_LOCAL == occ->type); 794 GNUNET_assert (OCC_TYPE_LOCAL == occ->type);
804 GNUNET_assert (NULL != occ->timeout_task); 795 GNUNET_assert (NULL != occ->timeout_task);
805 lp2c = &occ->p2ctx.local; 796 lp2c = &occ->p2ctx.local;
@@ -881,18 +872,18 @@ send_hello_thru_rocc (struct OverlayConnectContext *occ)
881 * send_hello_thru_rocc() 872 * send_hello_thru_rocc()
882 * 873 *
883 * @param cls the OverlayConnectContext 874 * @param cls the OverlayConnectContext
884 * @param tc the TaskContext from scheduler
885 */ 875 */
886static void 876static void
887send_hello (void *cls, 877send_hello (void *cls)
888 const struct GNUNET_SCHEDULER_TaskContext *tc)
889{ 878{
890 struct OverlayConnectContext *occ = cls; 879 struct OverlayConnectContext *occ = cls;
891 struct LocalPeer2Context *lp2c; 880 struct LocalPeer2Context *lp2c;
892 char *other_peer_str; 881 char *other_peer_str;
882 const struct GNUNET_SCHEDULER_TaskContext *tc;
893 883
894 occ->send_hello_task = NULL; 884 occ->send_hello_task = NULL;
895 GNUNET_assert (NULL != occ->timeout_task); 885 GNUNET_assert (NULL != occ->timeout_task);
886 tc = GNUNET_SCHEDULER_get_task_context ();
896 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 887 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
897 return; 888 return;
898 GNUNET_assert (NULL != occ->hello); 889 GNUNET_assert (NULL != occ->hello);
@@ -1652,11 +1643,9 @@ cleanup_rocc (struct RemoteOverlayConnectCtx *rocc)
1652 * Task to timeout rocc and cleanit up 1643 * Task to timeout rocc and cleanit up
1653 * 1644 *
1654 * @param cls the RemoteOverlayConnectCtx 1645 * @param cls the RemoteOverlayConnectCtx
1655 * @param tc the TaskContext from scheduler
1656 */ 1646 */
1657static void 1647static void
1658timeout_rocc_task (void *cls, 1648timeout_rocc_task (void *cls)
1659 const struct GNUNET_SCHEDULER_TaskContext *tc)
1660{ 1649{
1661 struct RemoteOverlayConnectCtx *rocc = cls; 1650 struct RemoteOverlayConnectCtx *rocc = cls;
1662 1651
@@ -1698,26 +1687,23 @@ cache_transport_peer_connect_notify (void *cls,
1698 * whose identity is in RemoteOverlayConnectCtx 1687 * whose identity is in RemoteOverlayConnectCtx
1699 * 1688 *
1700 * @param cls the RemoteOverlayConnectCtx 1689 * @param cls the RemoteOverlayConnectCtx
1701 * @param tc the TaskContext from scheduler
1702 */ 1690 */
1703static void 1691static void
1704attempt_connect_task (void *cls, 1692attempt_connect_task (void *cls);
1705 const struct GNUNET_SCHEDULER_TaskContext *tc);
1706 1693
1707 1694
1708/** 1695/**
1709 * Task that is run when hello has been sent 1696 * Task that is run when hello has been sent If tc->reason =
1697 * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
1698 * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
1710 * 1699 *
1711 * @param cls the overlay connect context 1700 * @param cls the overlay connect context
1712 * @param tc the scheduler task context; if tc->reason =
1713 * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
1714 * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
1715 */ 1701 */
1716static void 1702static void
1717rocc_hello_sent_cb (void *cls, 1703rocc_hello_sent_cb (void *cls)
1718 const struct GNUNET_SCHEDULER_TaskContext *tc)
1719{ 1704{
1720 struct RemoteOverlayConnectCtx *rocc = cls; 1705 struct RemoteOverlayConnectCtx *rocc = cls;
1706 const struct GNUNET_SCHEDULER_TaskContext *tc;
1721 1707
1722 rocc->ohh = NULL; 1708 rocc->ohh = NULL;
1723 GNUNET_assert (NULL == rocc->attempt_connect_task_id); 1709 GNUNET_assert (NULL == rocc->attempt_connect_task_id);
@@ -1725,6 +1711,7 @@ rocc_hello_sent_cb (void *cls,
1725 rocc->op_id, 1711 rocc->op_id,
1726 GNUNET_i2s (&rocc->a_id), 1712 GNUNET_i2s (&rocc->a_id),
1727 rocc->peer->id); 1713 rocc->peer->id);
1714 tc = GNUNET_SCHEDULER_get_task_context ();
1728 if (GNUNET_SCHEDULER_REASON_TIMEOUT == tc->reason) 1715 if (GNUNET_SCHEDULER_REASON_TIMEOUT == tc->reason)
1729 { 1716 {
1730 GNUNET_break (0); 1717 GNUNET_break (0);
@@ -1754,11 +1741,9 @@ rocc_hello_sent_cb (void *cls,
1754 * whose identity is in RemoteOverlayConnectCtx 1741 * whose identity is in RemoteOverlayConnectCtx
1755 * 1742 *
1756 * @param cls the RemoteOverlayConnectCtx 1743 * @param cls the RemoteOverlayConnectCtx
1757 * @param tc the TaskContext from scheduler
1758 */ 1744 */
1759static void 1745static void
1760attempt_connect_task (void *cls, 1746attempt_connect_task (void *cls)
1761 const struct GNUNET_SCHEDULER_TaskContext *tc)
1762{ 1747{
1763 struct RemoteOverlayConnectCtx *rocc = cls; 1748 struct RemoteOverlayConnectCtx *rocc = cls;
1764 1749