diff options
Diffstat (limited to 'src/testbed/gnunet-service-testbed_oc.c')
-rw-r--r-- | src/testbed/gnunet-service-testbed_oc.c | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c index 55f18d251..8b7a8a0ee 100644 --- a/src/testbed/gnunet-service-testbed_oc.c +++ b/src/testbed/gnunet-service-testbed_oc.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "gnunet-service-testbed.h" | 27 | #include "gnunet-service-testbed.h" |
28 | #include "gnunet-service-testbed_connectionpool.h" | ||
28 | 29 | ||
29 | /** | 30 | /** |
30 | * Redefine LOG with a changed log component string | 31 | * Redefine LOG with a changed log component string |
@@ -54,7 +55,7 @@ struct TryConnectContext | |||
54 | /** | 55 | /** |
55 | * The GetCacheHandle for the p1th transport handle | 56 | * The GetCacheHandle for the p1th transport handle |
56 | */ | 57 | */ |
57 | struct GSTCacheGetHandle *cgh_th; | 58 | struct GST_ConnectionPool_GetHandle *cgh_th; |
58 | 59 | ||
59 | /** | 60 | /** |
60 | * the try connect handle | 61 | * the try connect handle |
@@ -188,15 +189,15 @@ struct OverlayConnectContext | |||
188 | struct GNUNET_TRANSPORT_Handle *p1th_; | 189 | struct GNUNET_TRANSPORT_Handle *p1th_; |
189 | 190 | ||
190 | /** | 191 | /** |
191 | * The CacheGetHandle for the p1th transport handle | 192 | * The #GST_ConnectionPool_GetHandle for the peer1's transport handle |
192 | */ | 193 | */ |
193 | struct GSTCacheGetHandle *cgh_p1th; | 194 | struct GST_ConnectionPool_GetHandle *cgh_p1th; |
194 | 195 | ||
195 | /** | 196 | /** |
196 | * The GetCacheHandle for registering callback to notify CORE level peer | 197 | * The #GST_ConnectionPool_GetHandle for registering callback to notify CORE |
197 | * connects and to get our identity. | 198 | * level peer connects and to get our identity. |
198 | */ | 199 | */ |
199 | struct GSTCacheGetHandle *cgh_ch; | 200 | struct GST_ConnectionPool_GetHandle *cgh_ch; |
200 | 201 | ||
201 | /** | 202 | /** |
202 | * HELLO of the first peer. This should be sent to the second peer. | 203 | * HELLO of the first peer. This should be sent to the second peer. |
@@ -474,7 +475,7 @@ cleanup_occ_lp2c (struct LocalPeer2Context *lp2c) | |||
474 | if (NULL != lp2c->ohh) | 475 | if (NULL != lp2c->ohh) |
475 | GNUNET_TRANSPORT_offer_hello_cancel (lp2c->ohh); | 476 | GNUNET_TRANSPORT_offer_hello_cancel (lp2c->ohh); |
476 | if (NULL != lp2c->tcc.cgh_th) | 477 | if (NULL != lp2c->tcc.cgh_th) |
477 | GST_cache_get_handle_done (lp2c->tcc.cgh_th); | 478 | GST_connection_pool_get_handle_done (lp2c->tcc.cgh_th); |
478 | if (NULL != lp2c->tcc.tch) | 479 | if (NULL != lp2c->tcc.tch) |
479 | GNUNET_TRANSPORT_try_connect_cancel (lp2c->tcc.tch); | 480 | GNUNET_TRANSPORT_try_connect_cancel (lp2c->tcc.tch); |
480 | if (GNUNET_SCHEDULER_NO_TASK != lp2c->tcc.task) | 481 | if (GNUNET_SCHEDULER_NO_TASK != lp2c->tcc.task) |
@@ -529,11 +530,11 @@ cleanup_occ (struct OverlayConnectContext *occ) | |||
529 | if (GNUNET_SCHEDULER_NO_TASK != occ->timeout_task) | 530 | if (GNUNET_SCHEDULER_NO_TASK != occ->timeout_task) |
530 | GNUNET_SCHEDULER_cancel (occ->timeout_task); | 531 | GNUNET_SCHEDULER_cancel (occ->timeout_task); |
531 | if (NULL != occ->cgh_ch) | 532 | if (NULL != occ->cgh_ch) |
532 | GST_cache_get_handle_done (occ->cgh_ch); | 533 | GST_connection_pool_get_handle_done (occ->cgh_ch); |
533 | if (NULL != occ->ghh) | 534 | if (NULL != occ->ghh) |
534 | GNUNET_TRANSPORT_get_hello_cancel (occ->ghh); | 535 | GNUNET_TRANSPORT_get_hello_cancel (occ->ghh); |
535 | if (NULL != occ->cgh_p1th) | 536 | if (NULL != occ->cgh_p1th) |
536 | GST_cache_get_handle_done (occ->cgh_p1th); | 537 | GST_connection_pool_get_handle_done (occ->cgh_p1th); |
537 | GNUNET_assert (NULL != GST_peer_list); | 538 | GNUNET_assert (NULL != GST_peer_list); |
538 | GNUNET_assert (occ->peer->reference_cnt > 0); | 539 | GNUNET_assert (occ->peer->reference_cnt > 0); |
539 | occ->peer->reference_cnt--; | 540 | occ->peer->reference_cnt--; |
@@ -921,8 +922,9 @@ p2_transport_connect (struct OverlayConnectContext *occ) | |||
921 | { | 922 | { |
922 | GNUNET_assert (NULL != (peer2 = GST_peer_list[occ->other_peer_id])); | 923 | GNUNET_assert (NULL != (peer2 = GST_peer_list[occ->other_peer_id])); |
923 | occ->p2ctx.local.tcc.cgh_th = | 924 | occ->p2ctx.local.tcc.cgh_th = |
924 | GST_cache_get_handle_transport (occ->other_peer_id, | 925 | GST_connection_pool_get_handle (occ->other_peer_id, |
925 | peer2->details.local.cfg, | 926 | peer2->details.local.cfg, |
927 | GST_CONNECTIONPOOL_SERVICE_TRANSPORT, | ||
926 | &p2_transport_connect_cache_callback, | 928 | &p2_transport_connect_cache_callback, |
927 | occ, NULL, NULL, NULL); | 929 | occ, NULL, NULL, NULL); |
928 | return; | 930 | return; |
@@ -985,7 +987,7 @@ hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello) | |||
985 | memcpy (occ->hello, hello, msize); | 987 | memcpy (occ->hello, hello, msize); |
986 | GNUNET_TRANSPORT_get_hello_cancel (occ->ghh); | 988 | GNUNET_TRANSPORT_get_hello_cancel (occ->ghh); |
987 | occ->ghh = NULL; | 989 | occ->ghh = NULL; |
988 | GST_cache_get_handle_done (occ->cgh_p1th); | 990 | GST_connection_pool_get_handle_done (occ->cgh_p1th); |
989 | occ->cgh_p1th = NULL; | 991 | occ->cgh_p1th = NULL; |
990 | occ->p1th_ = NULL; | 992 | occ->p1th_ = NULL; |
991 | GNUNET_free_non_null (occ->emsg); | 993 | GNUNET_free_non_null (occ->emsg); |
@@ -1086,8 +1088,9 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1086 | "0x%llx: Timeout while acquiring TRANSPORT of %s from cache", | 1088 | "0x%llx: Timeout while acquiring TRANSPORT of %s from cache", |
1087 | occ->op_id, GNUNET_i2s (&occ->peer_identity)); | 1089 | occ->op_id, GNUNET_i2s (&occ->peer_identity)); |
1088 | occ->cgh_p1th = | 1090 | occ->cgh_p1th = |
1089 | GST_cache_get_handle_transport (occ->peer->id, | 1091 | GST_connection_pool_get_handle (occ->peer->id, |
1090 | occ->peer->details.local.cfg, | 1092 | occ->peer->details.local.cfg, |
1093 | GST_CONNECTIONPOOL_SERVICE_TRANSPORT, | ||
1091 | p1_transport_connect_cache_callback, occ, | 1094 | p1_transport_connect_cache_callback, occ, |
1092 | NULL, NULL, NULL); | 1095 | NULL, NULL, NULL); |
1093 | } | 1096 | } |
@@ -1127,10 +1130,12 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1127 | "0x%llx: Timeout while connecting to CORE of peer with " | 1130 | "0x%llx: Timeout while connecting to CORE of peer with " |
1128 | "id: %u", occ->op_id, occ->peer->id); | 1131 | "id: %u", occ->op_id, occ->peer->id); |
1129 | occ->cgh_ch = | 1132 | occ->cgh_ch = |
1130 | GST_cache_get_handle_core (occ->peer->id, occ->peer->details.local.cfg, | 1133 | GST_connection_pool_get_handle (occ->peer->id, |
1131 | occ_cache_get_handle_core_cb, occ, | 1134 | occ->peer->details.local.cfg, |
1132 | &occ->other_peer_identity, | 1135 | GST_CONNECTIONPOOL_SERVICE_CORE, |
1133 | &overlay_connect_notify, occ); | 1136 | occ_cache_get_handle_core_cb, occ, |
1137 | &occ->other_peer_identity, | ||
1138 | &overlay_connect_notify, occ); | ||
1134 | return; | 1139 | return; |
1135 | } | 1140 | } |
1136 | 1141 | ||
@@ -1481,10 +1486,12 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
1481 | "0x%llx: Timeout while connecting to CORE of peer with " | 1486 | "0x%llx: Timeout while connecting to CORE of peer with " |
1482 | "id: %u", occ->op_id, occ->peer->id); | 1487 | "id: %u", occ->op_id, occ->peer->id); |
1483 | occ->cgh_ch = | 1488 | occ->cgh_ch = |
1484 | GST_cache_get_handle_core (occ->peer->id, occ->peer->details.local.cfg, | 1489 | GST_connection_pool_get_handle (occ->peer->id, |
1485 | occ_cache_get_handle_core_cb, occ, | 1490 | occ->peer->details.local.cfg, |
1486 | &occ->other_peer_identity, | 1491 | GST_CONNECTIONPOOL_SERVICE_CORE, |
1487 | &overlay_connect_notify, occ); | 1492 | occ_cache_get_handle_core_cb, occ, |
1493 | &occ->other_peer_identity, | ||
1494 | &overlay_connect_notify, occ); | ||
1488 | break; | 1495 | break; |
1489 | } | 1496 | } |
1490 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1497 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -1511,8 +1518,7 @@ cleanup_rocc (struct RemoteOverlayConnectCtx *rocc) | |||
1511 | GNUNET_TRANSPORT_try_connect_cancel (rocc->tcc.tch); | 1518 | GNUNET_TRANSPORT_try_connect_cancel (rocc->tcc.tch); |
1512 | if (GNUNET_SCHEDULER_NO_TASK != rocc->tcc.task) | 1519 | if (GNUNET_SCHEDULER_NO_TASK != rocc->tcc.task) |
1513 | GNUNET_SCHEDULER_cancel (rocc->tcc.task); | 1520 | GNUNET_SCHEDULER_cancel (rocc->tcc.task); |
1514 | //GNUNET_TRANSPORT_disconnect (rocc->tcc.th_); | 1521 | GST_connection_pool_get_handle_done (rocc->tcc.cgh_th); |
1515 | GST_cache_get_handle_done (rocc->tcc.cgh_th); | ||
1516 | GNUNET_assert (rocc->peer->reference_cnt > 0); | 1522 | GNUNET_assert (rocc->peer->reference_cnt > 0); |
1517 | rocc->peer->reference_cnt--; | 1523 | rocc->peer->reference_cnt--; |
1518 | if ((GNUNET_YES == rocc->peer->destroy_flag) && | 1524 | if ((GNUNET_YES == rocc->peer->destroy_flag) && |
@@ -1752,8 +1758,11 @@ GST_handle_remote_overlay_connect (void *cls, | |||
1752 | memcpy (rocc->hello, msg->hello, hsize); | 1758 | memcpy (rocc->hello, msg->hello, hsize); |
1753 | rocc->tcc.op_id = rocc->op_id; | 1759 | rocc->tcc.op_id = rocc->op_id; |
1754 | rocc->tcc.cgh_th = | 1760 | rocc->tcc.cgh_th = |
1755 | GST_cache_get_handle_transport (peer_id, rocc->peer->details.local.cfg, | 1761 | GST_connection_pool_get_handle (peer_id, |
1756 | &rocc_cache_get_handle_transport_cb, rocc, | 1762 | rocc->peer->details.local.cfg, |
1763 | GST_CONNECTIONPOOL_SERVICE_TRANSPORT, | ||
1764 | &rocc_cache_get_handle_transport_cb, | ||
1765 | rocc, | ||
1757 | &rocc->a_id, | 1766 | &rocc->a_id, |
1758 | &cache_transport_peer_connect_notify, | 1767 | &cache_transport_peer_connect_notify, |
1759 | rocc); | 1768 | rocc); |