diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-29 21:55:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-29 21:55:23 +0000 |
commit | 49d8694f79f2c716fd56f803e64e0b9008179970 (patch) | |
tree | f62632bf512f270834d60b83cfb5bf6e30e4cf78 /src/testbed | |
parent | c5bf6746a62e43d0c96fed6bc474f1e42f4c1540 (diff) | |
download | gnunet-49d8694f79f2c716fd56f803e64e0b9008179970.tar.gz gnunet-49d8694f79f2c716fd56f803e64e0b9008179970.zip |
-convert to new transport API
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-service-testbed_connectionpool.c | 33 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_connectionpool.h | 4 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_oc.c | 22 |
3 files changed, 32 insertions, 27 deletions
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c index 020fcb8d7..3115285ea 100644 --- a/src/testbed/gnunet-service-testbed_connectionpool.c +++ b/src/testbed/gnunet-service-testbed_connectionpool.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet-service-testbed.h" | 27 | #include "gnunet-service-testbed.h" |
28 | #include "gnunet-service-testbed_connectionpool.h" | 28 | #include "gnunet-service-testbed_connectionpool.h" |
29 | #include "testbed_api_operations.h" | 29 | #include "testbed_api_operations.h" |
30 | #include "gnunet_transport_core_service.h" | ||
30 | 31 | ||
31 | /** | 32 | /** |
32 | * Redefine LOG with a changed log component string | 33 | * Redefine LOG with a changed log component string |
@@ -71,7 +72,7 @@ struct PooledConnection | |||
71 | /** | 72 | /** |
72 | * The transport handle to the peer corresponding to this entry; can be NULL | 73 | * The transport handle to the peer corresponding to this entry; can be NULL |
73 | */ | 74 | */ |
74 | struct GNUNET_TRANSPORT_Handle *handle_transport; | 75 | struct GNUNET_TRANSPORT_CoreHandle *handle_transport; |
75 | 76 | ||
76 | /** | 77 | /** |
77 | * The core handle to the peer corresponding to this entry; can be NULL | 78 | * The core handle to the peer corresponding to this entry; can be NULL |
@@ -525,16 +526,20 @@ peer_connect_notify_cb (void *cls, | |||
525 | * | 526 | * |
526 | * @param cls the #PooledConnection object | 527 | * @param cls the #PooledConnection object |
527 | * @param peer the peer that connected | 528 | * @param peer the peer that connected |
529 | * @param mq queue for sending data to @a peer | ||
530 | * @return NULL | ||
528 | */ | 531 | */ |
529 | static void | 532 | static void * |
530 | transport_peer_connect_notify_cb (void *cls, | 533 | transport_peer_connect_notify_cb (void *cls, |
531 | const struct GNUNET_PeerIdentity *peer) | 534 | const struct GNUNET_PeerIdentity *peer, |
535 | struct GNUNET_MQ_Handle *mq) | ||
532 | { | 536 | { |
533 | struct PooledConnection *entry = cls; | 537 | struct PooledConnection *entry = cls; |
534 | 538 | ||
535 | peer_connect_notify_cb (entry, | 539 | peer_connect_notify_cb (entry, |
536 | peer, | 540 | peer, |
537 | GST_CONNECTIONPOOL_SERVICE_TRANSPORT); | 541 | GST_CONNECTIONPOOL_SERVICE_TRANSPORT); |
542 | return NULL; | ||
538 | } | 543 | } |
539 | 544 | ||
540 | 545 | ||
@@ -553,12 +558,13 @@ opstart_get_handle_transport (void *cls) | |||
553 | LOG_DEBUG ("Opening a transport connection to peer %u\n", | 558 | LOG_DEBUG ("Opening a transport connection to peer %u\n", |
554 | entry->index); | 559 | entry->index); |
555 | entry->handle_transport = | 560 | entry->handle_transport = |
556 | GNUNET_TRANSPORT_connect (entry->cfg, | 561 | GNUNET_TRANSPORT_core_connect (entry->cfg, |
557 | NULL, | 562 | NULL, |
558 | entry, | 563 | NULL, |
559 | NULL, | 564 | entry, |
560 | &transport_peer_connect_notify_cb, | 565 | &transport_peer_connect_notify_cb, |
561 | NULL); | 566 | NULL, |
567 | NULL); | ||
562 | if (NULL == entry->handle_transport) | 568 | if (NULL == entry->handle_transport) |
563 | { | 569 | { |
564 | GNUNET_break (0); | 570 | GNUNET_break (0); |
@@ -589,7 +595,7 @@ oprelease_get_handle_transport (void *cls) | |||
589 | 595 | ||
590 | if (NULL == entry->handle_transport) | 596 | if (NULL == entry->handle_transport) |
591 | return; | 597 | return; |
592 | GNUNET_TRANSPORT_disconnect (entry->handle_transport); | 598 | GNUNET_TRANSPORT_core_disconnect (entry->handle_transport); |
593 | entry->handle_transport = NULL; | 599 | entry->handle_transport = NULL; |
594 | } | 600 | } |
595 | 601 | ||
@@ -601,7 +607,8 @@ oprelease_get_handle_transport (void *cls) | |||
601 | * @param peer peer identity this notification is about | 607 | * @param peer peer identity this notification is about |
602 | */ | 608 | */ |
603 | static void | 609 | static void |
604 | core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) | 610 | core_peer_connect_cb (void *cls, |
611 | const struct GNUNET_PeerIdentity *peer) | ||
605 | { | 612 | { |
606 | struct PooledConnection *entry = cls; | 613 | struct PooledConnection *entry = cls; |
607 | 614 | ||
@@ -634,9 +641,7 @@ core_startup_cb (void *cls, | |||
634 | } | 641 | } |
635 | GNUNET_assert (NULL == entry->peer_identity); | 642 | GNUNET_assert (NULL == entry->peer_identity); |
636 | entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity); | 643 | entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity); |
637 | GNUNET_memcpy (entry->peer_identity, | 644 | *entry->peer_identity = *my_identity; |
638 | my_identity, | ||
639 | sizeof (struct GNUNET_PeerIdentity)); | ||
640 | if (0 == entry->demand) | 645 | if (0 == entry->demand) |
641 | return; | 646 | return; |
642 | if (NULL != entry->notify_task) | 647 | if (NULL != entry->notify_task) |
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.h b/src/testbed/gnunet-service-testbed_connectionpool.h index 54b37f6d5..dc887ff8c 100644 --- a/src/testbed/gnunet-service-testbed_connectionpool.h +++ b/src/testbed/gnunet-service-testbed_connectionpool.h | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "gnunet_ats_service.h" | 26 | #include "gnunet_ats_service.h" |
27 | #include "gnunet_core_service.h" | 27 | #include "gnunet_core_service.h" |
28 | #include "gnunet_transport_service.h" | 28 | #include "gnunet_transport_core_service.h" |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * The request handle for obtaining a pooled connection | 31 | * The request handle for obtaining a pooled connection |
@@ -90,7 +90,7 @@ GST_connection_pool_destroy (void); | |||
90 | typedef void | 90 | typedef void |
91 | (*GST_connection_pool_connection_ready_cb) (void *cls, | 91 | (*GST_connection_pool_connection_ready_cb) (void *cls, |
92 | struct GNUNET_CORE_Handle *ch, | 92 | struct GNUNET_CORE_Handle *ch, |
93 | struct GNUNET_TRANSPORT_Handle *th, | 93 | struct GNUNET_TRANSPORT_CoreHandle *th, |
94 | struct GNUNET_ATS_ConnectivityHandle *ac, | 94 | struct GNUNET_ATS_ConnectivityHandle *ac, |
95 | const struct GNUNET_PeerIdentity *peer_id, | 95 | const struct GNUNET_PeerIdentity *peer_id, |
96 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 96 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c index cf74ea04e..02c369aaa 100644 --- a/src/testbed/gnunet-service-testbed_oc.c +++ b/src/testbed/gnunet-service-testbed_oc.c | |||
@@ -46,7 +46,7 @@ struct ConnectivitySuggestContext | |||
46 | /** | 46 | /** |
47 | * The transport handle obtained from cache. Do NOT close/disconnect. | 47 | * The transport handle obtained from cache. Do NOT close/disconnect. |
48 | */ | 48 | */ |
49 | struct GNUNET_TRANSPORT_Handle *th_; | 49 | struct GNUNET_TRANSPORT_CoreHandle *th_; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Configuration of the peer from cache. Do not free! | 52 | * Configuration of the peer from cache. Do not free! |
@@ -178,7 +178,7 @@ struct OverlayConnectContext | |||
178 | * Transport handle of the first peer obtained from cache to get its HELLO. Do | 178 | * Transport handle of the first peer obtained from cache to get its HELLO. Do |
179 | * NOT close/disconnect. | 179 | * NOT close/disconnect. |
180 | */ | 180 | */ |
181 | struct GNUNET_TRANSPORT_Handle *p1th_; | 181 | struct GNUNET_TRANSPORT_CoreHandle *p1th_; |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * The #GST_ConnectionPool_GetHandle for the peer1's transport handle | 184 | * The #GST_ConnectionPool_GetHandle for the peer1's transport handle |
@@ -709,7 +709,7 @@ overlay_connect_notify (void *cls, | |||
709 | static void | 709 | static void |
710 | occ_cache_get_handle_ats_occ_cb (void *cls, | 710 | occ_cache_get_handle_ats_occ_cb (void *cls, |
711 | struct GNUNET_CORE_Handle *ch, | 711 | struct GNUNET_CORE_Handle *ch, |
712 | struct GNUNET_TRANSPORT_Handle *th, | 712 | struct GNUNET_TRANSPORT_CoreHandle *th, |
713 | struct GNUNET_ATS_ConnectivityHandle *ac, | 713 | struct GNUNET_ATS_ConnectivityHandle *ac, |
714 | const struct GNUNET_PeerIdentity *my_identity, | 714 | const struct GNUNET_PeerIdentity *my_identity, |
715 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 715 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -759,7 +759,7 @@ occ_cache_get_handle_ats_occ_cb (void *cls, | |||
759 | static void | 759 | static void |
760 | occ_cache_get_handle_ats_rocc_cb (void *cls, | 760 | occ_cache_get_handle_ats_rocc_cb (void *cls, |
761 | struct GNUNET_CORE_Handle *ch, | 761 | struct GNUNET_CORE_Handle *ch, |
762 | struct GNUNET_TRANSPORT_Handle *th, | 762 | struct GNUNET_TRANSPORT_CoreHandle *th, |
763 | struct GNUNET_ATS_ConnectivityHandle *ac, | 763 | struct GNUNET_ATS_ConnectivityHandle *ac, |
764 | const struct GNUNET_PeerIdentity *my_identity, | 764 | const struct GNUNET_PeerIdentity *my_identity, |
765 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 765 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -921,7 +921,7 @@ send_hello (void *cls) | |||
921 | static void | 921 | static void |
922 | p2_transport_connect_cache_callback (void *cls, | 922 | p2_transport_connect_cache_callback (void *cls, |
923 | struct GNUNET_CORE_Handle *ch, | 923 | struct GNUNET_CORE_Handle *ch, |
924 | struct GNUNET_TRANSPORT_Handle *th, | 924 | struct GNUNET_TRANSPORT_CoreHandle *th, |
925 | struct GNUNET_ATS_ConnectivityHandle *ac, | 925 | struct GNUNET_ATS_ConnectivityHandle *ac, |
926 | const struct GNUNET_PeerIdentity *ignore_, | 926 | const struct GNUNET_PeerIdentity *ignore_, |
927 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 927 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -1063,7 +1063,7 @@ hello_update_cb (void *cls, | |||
1063 | static void | 1063 | static void |
1064 | p1_transport_connect_cache_callback (void *cls, | 1064 | p1_transport_connect_cache_callback (void *cls, |
1065 | struct GNUNET_CORE_Handle *ch, | 1065 | struct GNUNET_CORE_Handle *ch, |
1066 | struct GNUNET_TRANSPORT_Handle *th, | 1066 | struct GNUNET_TRANSPORT_CoreHandle *th, |
1067 | struct GNUNET_ATS_ConnectivityHandle *ac, | 1067 | struct GNUNET_ATS_ConnectivityHandle *ac, |
1068 | const struct GNUNET_PeerIdentity *ignore_, | 1068 | const struct GNUNET_PeerIdentity *ignore_, |
1069 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 1069 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -1108,7 +1108,7 @@ p1_transport_connect_cache_callback (void *cls, | |||
1108 | static void | 1108 | static void |
1109 | occ_cache_get_handle_core_cb (void *cls, | 1109 | occ_cache_get_handle_core_cb (void *cls, |
1110 | struct GNUNET_CORE_Handle *ch, | 1110 | struct GNUNET_CORE_Handle *ch, |
1111 | struct GNUNET_TRANSPORT_Handle *th, | 1111 | struct GNUNET_TRANSPORT_CoreHandle *th, |
1112 | struct GNUNET_ATS_ConnectivityHandle *ac, | 1112 | struct GNUNET_ATS_ConnectivityHandle *ac, |
1113 | const struct GNUNET_PeerIdentity *my_identity, | 1113 | const struct GNUNET_PeerIdentity *my_identity, |
1114 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 1114 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -1759,7 +1759,7 @@ attempt_connect_task (void *cls) | |||
1759 | static void | 1759 | static void |
1760 | rocc_cache_get_handle_transport_cb (void *cls, | 1760 | rocc_cache_get_handle_transport_cb (void *cls, |
1761 | struct GNUNET_CORE_Handle *ch, | 1761 | struct GNUNET_CORE_Handle *ch, |
1762 | struct GNUNET_TRANSPORT_Handle *th, | 1762 | struct GNUNET_TRANSPORT_CoreHandle *th, |
1763 | struct GNUNET_ATS_ConnectivityHandle *ac, | 1763 | struct GNUNET_ATS_ConnectivityHandle *ac, |
1764 | const struct GNUNET_PeerIdentity *ignore_, | 1764 | const struct GNUNET_PeerIdentity *ignore_, |
1765 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 1765 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -1774,9 +1774,9 @@ rocc_cache_get_handle_transport_cb (void *cls, | |||
1774 | } | 1774 | } |
1775 | rocc->tcc.th_ = th; | 1775 | rocc->tcc.th_ = th; |
1776 | rocc->tcc.cfg = cfg; | 1776 | rocc->tcc.cfg = cfg; |
1777 | if (GNUNET_YES == | 1777 | if (NULL != |
1778 | GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, | 1778 | GNUNET_TRANSPORT_core_get_mq (rocc->tcc.th_, |
1779 | &rocc->a_id)) | 1779 | &rocc->a_id)) |
1780 | { | 1780 | { |
1781 | LOG_DEBUG ("0x%llx: Target peer %s already connected to local peer: %u\n", | 1781 | LOG_DEBUG ("0x%llx: Target peer %s already connected to local peer: %u\n", |
1782 | rocc->op_id, | 1782 | rocc->op_id, |