aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-08 16:34:31 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-08 16:34:31 +0000
commit6e3599bab213760c66f13f6103ebf650bbe5b7e9 (patch)
treef56a0bbe3ce64c818c87bae6171ba800ab05b701 /src/testbed
parent2c0a286c8c29e135c68556658b6ac6cef48a874a (diff)
downloadgnunet-6e3599bab213760c66f13f6103ebf650bbe5b7e9.tar.gz
gnunet-6e3599bab213760c66f13f6103ebf650bbe5b7e9.zip
migrate transport_core API to MQ
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c3
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.h4
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c35
3 files changed, 30 insertions, 12 deletions
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c
index 0fa2a6456..47b6fab08 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.c
+++ b/src/testbed/gnunet-service-testbed_connectionpool.c
@@ -463,7 +463,8 @@ connection_ready (void *cls)
463 entry->handle_core, 463 entry->handle_core,
464 entry->handle_transport, 464 entry->handle_transport,
465 entry->handle_ats_connectivity, 465 entry->handle_ats_connectivity,
466 entry->peer_identity); 466 entry->peer_identity,
467 entry->cfg);
467} 468}
468 469
469 470
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.h b/src/testbed/gnunet-service-testbed_connectionpool.h
index 589421840..54b37f6d5 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.h
+++ b/src/testbed/gnunet-service-testbed_connectionpool.h
@@ -85,13 +85,15 @@ GST_connection_pool_destroy (void);
85 * @param ac the handle to ATS, can be NULL if it is not requested 85 * @param ac the handle to ATS, can be NULL if it is not requested
86 * @param peer_id the identity of the peer. Will be NULL if ch is NULL. In other 86 * @param peer_id the identity of the peer. Will be NULL if ch is NULL. In other
87 * cases, its value being NULL means that CORE connection has failed. 87 * cases, its value being NULL means that CORE connection has failed.
88 * @param cfg configuration of the peer
88 */ 89 */
89typedef void 90typedef void
90(*GST_connection_pool_connection_ready_cb) (void *cls, 91(*GST_connection_pool_connection_ready_cb) (void *cls,
91 struct GNUNET_CORE_Handle *ch, 92 struct GNUNET_CORE_Handle *ch,
92 struct GNUNET_TRANSPORT_Handle *th, 93 struct GNUNET_TRANSPORT_Handle *th,
93 struct GNUNET_ATS_ConnectivityHandle *ac, 94 struct GNUNET_ATS_ConnectivityHandle *ac,
94 const struct GNUNET_PeerIdentity *peer_id); 95 const struct GNUNET_PeerIdentity *peer_id,
96 const struct GNUNET_CONFIGURATION_Handle *cfg);
95 97
96 98
97/** 99/**
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index de462da7a..8902a359c 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -49,6 +49,11 @@ struct ConnectivitySuggestContext
49 struct GNUNET_TRANSPORT_Handle *th_; 49 struct GNUNET_TRANSPORT_Handle *th_;
50 50
51 /** 51 /**
52 * Configuration of the peer from cache. Do not free!
53 */
54 const struct GNUNET_CONFIGURATION_Handle *cfg;
55
56 /**
52 * The GetCacheHandle for the peer2's transport handle 57 * The GetCacheHandle for the peer2's transport handle
53 * (used to offer the HELLO to the peer). 58 * (used to offer the HELLO to the peer).
54 */ 59 */
@@ -699,13 +704,15 @@ overlay_connect_notify (void *cls,
699 * @param th the handle to TRANSPORT. Can be NULL if it is not requested 704 * @param th the handle to TRANSPORT. Can be NULL if it is not requested
700 * @param ac the handle to ATS. Can be NULL if it is not requested 705 * @param ac the handle to ATS. Can be NULL if it is not requested
701 * @param my_identity the identity of our peer 706 * @param my_identity the identity of our peer
707 * @param cfg configuration of the peer
702 */ 708 */
703static void 709static void
704occ_cache_get_handle_ats_occ_cb (void *cls, 710occ_cache_get_handle_ats_occ_cb (void *cls,
705 struct GNUNET_CORE_Handle *ch, 711 struct GNUNET_CORE_Handle *ch,
706 struct GNUNET_TRANSPORT_Handle *th, 712 struct GNUNET_TRANSPORT_Handle *th,
707 struct GNUNET_ATS_ConnectivityHandle *ac, 713 struct GNUNET_ATS_ConnectivityHandle *ac,
708 const struct GNUNET_PeerIdentity *my_identity) 714 const struct GNUNET_PeerIdentity *my_identity,
715 const struct GNUNET_CONFIGURATION_Handle *cfg)
709{ 716{
710 struct OverlayConnectContext *occ = cls; 717 struct OverlayConnectContext *occ = cls;
711 struct LocalPeer2Context *lp2c; 718 struct LocalPeer2Context *lp2c;
@@ -754,7 +761,8 @@ occ_cache_get_handle_ats_rocc_cb (void *cls,
754 struct GNUNET_CORE_Handle *ch, 761 struct GNUNET_CORE_Handle *ch,
755 struct GNUNET_TRANSPORT_Handle *th, 762 struct GNUNET_TRANSPORT_Handle *th,
756 struct GNUNET_ATS_ConnectivityHandle *ac, 763 struct GNUNET_ATS_ConnectivityHandle *ac,
757 const struct GNUNET_PeerIdentity *my_identity) 764 const struct GNUNET_PeerIdentity *my_identity,
765 const struct GNUNET_CONFIGURATION_Handle *cfg)
758{ 766{
759 struct RemoteOverlayConnectCtx *rocc = cls; 767 struct RemoteOverlayConnectCtx *rocc = cls;
760 768
@@ -896,7 +904,7 @@ send_hello (void *cls)
896 other_peer_str); 904 other_peer_str);
897 GNUNET_free (other_peer_str); 905 GNUNET_free (other_peer_str);
898 lp2c->ohh = 906 lp2c->ohh =
899 GNUNET_TRANSPORT_offer_hello (lp2c->tcc.th_, 907 GNUNET_TRANSPORT_offer_hello (lp2c->tcc.cfg,
900 occ->hello, 908 occ->hello,
901 occ_hello_sent_cb, 909 occ_hello_sent_cb,
902 occ); 910 occ);
@@ -922,13 +930,15 @@ send_hello (void *cls)
922 * @param th the handle to TRANSPORT. Can be NULL if it is not requested 930 * @param th the handle to TRANSPORT. Can be NULL if it is not requested
923 * @param ac the handle to ATS. Can be NULL if it is not requested 931 * @param ac the handle to ATS. Can be NULL if it is not requested
924 * @param ignore_ peer identity which is ignored in this callback 932 * @param ignore_ peer identity which is ignored in this callback
925 */ 933 * @param cfg configuration of the peer
934*/
926static void 935static void
927p2_transport_connect_cache_callback (void *cls, 936p2_transport_connect_cache_callback (void *cls,
928 struct GNUNET_CORE_Handle *ch, 937 struct GNUNET_CORE_Handle *ch,
929 struct GNUNET_TRANSPORT_Handle *th, 938 struct GNUNET_TRANSPORT_Handle *th,
930 struct GNUNET_ATS_ConnectivityHandle *ac, 939 struct GNUNET_ATS_ConnectivityHandle *ac,
931 const struct GNUNET_PeerIdentity *ignore_) 940 const struct GNUNET_PeerIdentity *ignore_,
941 const struct GNUNET_CONFIGURATION_Handle *cfg)
932{ 942{
933 struct OverlayConnectContext *occ = cls; 943 struct OverlayConnectContext *occ = cls;
934 944
@@ -945,6 +955,7 @@ p2_transport_connect_cache_callback (void *cls,
945 return; 955 return;
946 } 956 }
947 occ->p2ctx.local.tcc.th_ = th; 957 occ->p2ctx.local.tcc.th_ = th;
958 occ->p2ctx.local.tcc.cfg = cfg;
948 GNUNET_asprintf (&occ->emsg, 959 GNUNET_asprintf (&occ->emsg,
949 "0x%llx: Timeout while offering HELLO to %s", 960 "0x%llx: Timeout while offering HELLO to %s",
950 occ->op_id, 961 occ->op_id,
@@ -1068,7 +1079,8 @@ p1_transport_connect_cache_callback (void *cls,
1068 struct GNUNET_CORE_Handle *ch, 1079 struct GNUNET_CORE_Handle *ch,
1069 struct GNUNET_TRANSPORT_Handle *th, 1080 struct GNUNET_TRANSPORT_Handle *th,
1070 struct GNUNET_ATS_ConnectivityHandle *ac, 1081 struct GNUNET_ATS_ConnectivityHandle *ac,
1071 const struct GNUNET_PeerIdentity *ignore_) 1082 const struct GNUNET_PeerIdentity *ignore_,
1083 const struct GNUNET_CONFIGURATION_Handle *cfg)
1072{ 1084{
1073 struct OverlayConnectContext *occ = cls; 1085 struct OverlayConnectContext *occ = cls;
1074 1086
@@ -1092,7 +1104,7 @@ p1_transport_connect_cache_callback (void *cls,
1092 "0x%llx: Timeout while acquiring HELLO of peer %s", 1104 "0x%llx: Timeout while acquiring HELLO of peer %s",
1093 occ->op_id, 1105 occ->op_id,
1094 GNUNET_i2s (&occ->peer_identity)); 1106 GNUNET_i2s (&occ->peer_identity));
1095 occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p1th_, 1107 occ->ghh = GNUNET_TRANSPORT_get_hello (cfg,
1096 &hello_update_cb, 1108 &hello_update_cb,
1097 occ); 1109 occ);
1098} 1110}
@@ -1112,7 +1124,8 @@ occ_cache_get_handle_core_cb (void *cls,
1112 struct GNUNET_CORE_Handle *ch, 1124 struct GNUNET_CORE_Handle *ch,
1113 struct GNUNET_TRANSPORT_Handle *th, 1125 struct GNUNET_TRANSPORT_Handle *th,
1114 struct GNUNET_ATS_ConnectivityHandle *ac, 1126 struct GNUNET_ATS_ConnectivityHandle *ac,
1115 const struct GNUNET_PeerIdentity *my_identity) 1127 const struct GNUNET_PeerIdentity *my_identity,
1128 const struct GNUNET_CONFIGURATION_Handle *cfg)
1116{ 1129{
1117 struct OverlayConnectContext *occ = cls; 1130 struct OverlayConnectContext *occ = cls;
1118 const struct GNUNET_MessageHeader *hello; 1131 const struct GNUNET_MessageHeader *hello;
@@ -1743,7 +1756,7 @@ attempt_connect_task (void *cls)
1743 GNUNET_i2s (&rocc->a_id), 1756 GNUNET_i2s (&rocc->a_id),
1744 rocc->peer->id); 1757 rocc->peer->id);
1745 rocc->ohh = 1758 rocc->ohh =
1746 GNUNET_TRANSPORT_offer_hello (rocc->tcc.th_, 1759 GNUNET_TRANSPORT_offer_hello (rocc->tcc.cfg,
1747 rocc->hello, 1760 rocc->hello,
1748 &rocc_hello_sent_cb, 1761 &rocc_hello_sent_cb,
1749 rocc); 1762 rocc);
@@ -1772,7 +1785,8 @@ rocc_cache_get_handle_transport_cb (void *cls,
1772 struct GNUNET_CORE_Handle *ch, 1785 struct GNUNET_CORE_Handle *ch,
1773 struct GNUNET_TRANSPORT_Handle *th, 1786 struct GNUNET_TRANSPORT_Handle *th,
1774 struct GNUNET_ATS_ConnectivityHandle *ac, 1787 struct GNUNET_ATS_ConnectivityHandle *ac,
1775 const struct GNUNET_PeerIdentity *ignore_) 1788 const struct GNUNET_PeerIdentity *ignore_,
1789 const struct GNUNET_CONFIGURATION_Handle *cfg)
1776{ 1790{
1777 struct RemoteOverlayConnectCtx *rocc = cls; 1791 struct RemoteOverlayConnectCtx *rocc = cls;
1778 1792
@@ -1783,6 +1797,7 @@ rocc_cache_get_handle_transport_cb (void *cls,
1783 return; 1797 return;
1784 } 1798 }
1785 rocc->tcc.th_ = th; 1799 rocc->tcc.th_ = th;
1800 rocc->tcc.cfg = cfg;
1786 if (GNUNET_YES == 1801 if (GNUNET_YES ==
1787 GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, 1802 GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_,
1788 &rocc->a_id)) 1803 &rocc->a_id))