diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-27 14:49:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-27 14:49:03 +0000 |
commit | 6b048559eadd3e57fda24a23d3f3b4681d4e1408 (patch) | |
tree | 88c6f0ab9f0dda3d090f95adfd365078e6ed3b1a | |
parent | 57d4c0d631fc90945e92f264c841068a8be6565f (diff) | |
download | gnunet-6b048559eadd3e57fda24a23d3f3b4681d4e1408.tar.gz gnunet-6b048559eadd3e57fda24a23d3f3b4681d4e1408.zip |
prepare testbed for #3675 by having an option to establish connections to ATS
-rw-r--r-- | src/testbed/Makefile.am | 1 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_connectionpool.c | 113 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_connectionpool.h | 27 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_oc.c | 61 |
4 files changed, 160 insertions, 42 deletions
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index edb4ae672..8b5d7457a 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am | |||
@@ -53,6 +53,7 @@ gnunet_service_testbed_LDADD = $(XLIB) \ | |||
53 | $(top_builddir)/src/core/libgnunetcore.la \ | 53 | $(top_builddir)/src/core/libgnunetcore.la \ |
54 | $(top_builddir)/src/hello/libgnunethello.la \ | 54 | $(top_builddir)/src/hello/libgnunethello.la \ |
55 | $(top_builddir)/src/transport/libgnunettransport.la \ | 55 | $(top_builddir)/src/transport/libgnunettransport.la \ |
56 | $(top_builddir)/src/ats/libgnunetats.la \ | ||
56 | $(top_builddir)/src/testing/libgnunettesting.la \ | 57 | $(top_builddir)/src/testing/libgnunettesting.la \ |
57 | libgnunettestbed.la \ | 58 | libgnunettestbed.la \ |
58 | $(top_builddir)/src/arm/libgnunetarm.la \ | 59 | $(top_builddir)/src/arm/libgnunetarm.la \ |
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c index 0f65edf15..4ca13ed42 100644 --- a/src/testbed/gnunet-service-testbed_connectionpool.c +++ b/src/testbed/gnunet-service-testbed_connectionpool.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2008--2013 Christian Grothoff (and other contributing authors) | 3 | Copyright (C) 2008--2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -79,6 +79,11 @@ struct PooledConnection | |||
79 | struct GNUNET_CORE_Handle *handle_core; | 79 | struct GNUNET_CORE_Handle *handle_core; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * The ATS handle to the peer correspondign to this entry; can be NULL. | ||
83 | */ | ||
84 | struct GNUNET_ATS_ConnectivityHandle *handle_ats_connectivity; | ||
85 | |||
86 | /** | ||
82 | * The operation handle for transport handle | 87 | * The operation handle for transport handle |
83 | */ | 88 | */ |
84 | struct GNUNET_TESTBED_Operation *op_transport; | 89 | struct GNUNET_TESTBED_Operation *op_transport; |
@@ -89,6 +94,11 @@ struct PooledConnection | |||
89 | struct GNUNET_TESTBED_Operation *op_core; | 94 | struct GNUNET_TESTBED_Operation *op_core; |
90 | 95 | ||
91 | /** | 96 | /** |
97 | * The operation handle for ATS handle | ||
98 | */ | ||
99 | struct GNUNET_TESTBED_Operation *op_ats_connectivity; | ||
100 | |||
101 | /** | ||
92 | * The peer identity of this peer. Will be set upon opening a connection to | 102 | * The peer identity of this peer. Will be set upon opening a connection to |
93 | * the peers CORE service. Will be NULL until then and after the CORE | 103 | * the peers CORE service. Will be NULL until then and after the CORE |
94 | * connection is closed | 104 | * connection is closed |
@@ -299,12 +309,20 @@ destroy_pooled_connection (struct PooledConnection *entry) | |||
299 | GNUNET_TESTBED_operation_done (entry->op_transport); | 309 | GNUNET_TESTBED_operation_done (entry->op_transport); |
300 | entry->op_transport = NULL; | 310 | entry->op_transport = NULL; |
301 | } | 311 | } |
312 | if (NULL != entry->handle_ats_connectivity) | ||
313 | GNUNET_assert (NULL != entry->op_ats_connectivity); | ||
314 | if (NULL != entry->op_ats_connectivity) | ||
315 | { | ||
316 | GNUNET_TESTBED_operation_done (entry->op_ats_connectivity); | ||
317 | entry->op_ats_connectivity = NULL; | ||
318 | } | ||
302 | if (NULL != entry->op_core) | 319 | if (NULL != entry->op_core) |
303 | { | 320 | { |
304 | GNUNET_TESTBED_operation_done (entry->op_core); | 321 | GNUNET_TESTBED_operation_done (entry->op_core); |
305 | entry->op_core = NULL; | 322 | entry->op_core = NULL; |
306 | } | 323 | } |
307 | GNUNET_assert (NULL == entry->handle_core); | 324 | GNUNET_assert (NULL == entry->handle_core); |
325 | GNUNET_assert (NULL == entry->handle_ats_connectivity); | ||
308 | GNUNET_assert (NULL == entry->handle_transport); | 326 | GNUNET_assert (NULL == entry->handle_transport); |
309 | GNUNET_CONFIGURATION_destroy (entry->cfg); | 327 | GNUNET_CONFIGURATION_destroy (entry->cfg); |
310 | GNUNET_free (entry); | 328 | GNUNET_free (entry); |
@@ -318,7 +336,8 @@ destroy_pooled_connection (struct PooledConnection *entry) | |||
318 | * @param tc scheduler task context | 336 | * @param tc scheduler task context |
319 | */ | 337 | */ |
320 | static void | 338 | static void |
321 | expire (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 339 | expire (void *cls, |
340 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
322 | { | 341 | { |
323 | struct PooledConnection *entry = cls; | 342 | struct PooledConnection *entry = cls; |
324 | 343 | ||
@@ -392,6 +411,10 @@ search_waiting (const struct PooledConnection *entry, | |||
392 | if (NULL == entry->handle_transport) | 411 | if (NULL == entry->handle_transport) |
393 | continue; | 412 | continue; |
394 | break; | 413 | break; |
414 | case GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY: | ||
415 | if (NULL == entry->handle_ats_connectivity) | ||
416 | continue; | ||
417 | break; | ||
395 | } | 418 | } |
396 | break; | 419 | break; |
397 | } | 420 | } |
@@ -422,18 +445,27 @@ connection_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
422 | gh_next = NULL; | 445 | gh_next = NULL; |
423 | if (NULL != gh->next) | 446 | if (NULL != gh->next) |
424 | gh_next = search_waiting (entry, gh->next); | 447 | gh_next = search_waiting (entry, gh->next); |
425 | GNUNET_CONTAINER_DLL_remove (entry->head_waiting, entry->tail_waiting, gh); | 448 | GNUNET_CONTAINER_DLL_remove (entry->head_waiting, |
449 | entry->tail_waiting, | ||
450 | gh); | ||
426 | gh->connection_ready_called = 1; | 451 | gh->connection_ready_called = 1; |
427 | if (NULL != gh_next) | 452 | if (NULL != gh_next) |
428 | entry->notify_task = GNUNET_SCHEDULER_add_now (&connection_ready, entry); | 453 | entry->notify_task = GNUNET_SCHEDULER_add_now (&connection_ready, |
429 | if ( (NULL != gh->target) && (NULL != gh->connect_notify_cb) ) | 454 | entry); |
455 | if ( (NULL != gh->target) && | ||
456 | (NULL != gh->connect_notify_cb) ) | ||
430 | { | 457 | { |
431 | GNUNET_CONTAINER_DLL_insert_tail (entry->head_notify, entry->tail_notify, | 458 | GNUNET_CONTAINER_DLL_insert_tail (entry->head_notify, |
459 | entry->tail_notify, | ||
432 | gh); | 460 | gh); |
433 | gh->notify_waiting = 1; | 461 | gh->notify_waiting = 1; |
434 | } | 462 | } |
435 | LOG_DEBUG ("Connection ready for handle type %u\n", gh->service); | 463 | LOG_DEBUG ("Connection ready for handle type %u\n", |
436 | gh->cb (gh->cb_cls, entry->handle_core, entry->handle_transport, | 464 | gh->service); |
465 | gh->cb (gh->cb_cls, | ||
466 | entry->handle_core, | ||
467 | entry->handle_transport, | ||
468 | entry->handle_ats_connectivity, | ||
437 | entry->peer_identity); | 469 | entry->peer_identity); |
438 | } | 470 | } |
439 | 471 | ||
@@ -448,7 +480,8 @@ connection_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
448 | * @param service the service where this notification has originated | 480 | * @param service the service where this notification has originated |
449 | */ | 481 | */ |
450 | static void | 482 | static void |
451 | peer_connect_notify_cb (void *cls, const struct GNUNET_PeerIdentity *peer, | 483 | peer_connect_notify_cb (void *cls, |
484 | const struct GNUNET_PeerIdentity *peer, | ||
452 | const enum GST_ConnectionPool_Service service) | 485 | const enum GST_ConnectionPool_Service service) |
453 | { | 486 | { |
454 | struct PooledConnection *entry = cls; | 487 | struct PooledConnection *entry = cls; |
@@ -467,7 +500,9 @@ peer_connect_notify_cb (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
467 | gh = gh->next; | 500 | gh = gh->next; |
468 | continue; | 501 | continue; |
469 | } | 502 | } |
470 | if (0 != memcmp (gh->target, peer, sizeof (struct GNUNET_PeerIdentity))) | 503 | if (0 != memcmp (gh->target, |
504 | peer, | ||
505 | sizeof (struct GNUNET_PeerIdentity))) | ||
471 | { | 506 | { |
472 | gh = gh->next; | 507 | gh = gh->next; |
473 | continue; | 508 | continue; |
@@ -477,7 +512,9 @@ peer_connect_notify_cb (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
477 | gh_next = gh->next; | 512 | gh_next = gh->next; |
478 | GNUNET_CONTAINER_DLL_remove (entry->head_notify, entry->tail_notify, gh); | 513 | GNUNET_CONTAINER_DLL_remove (entry->head_notify, entry->tail_notify, gh); |
479 | gh->notify_waiting = 0; | 514 | gh->notify_waiting = 0; |
480 | LOG_DEBUG ("Peer connected to peer %u at service %u\n", entry->index, gh->service); | 515 | LOG_DEBUG ("Peer connected to peer %u at service %u\n", |
516 | entry->index, | ||
517 | gh->service); | ||
481 | gh = gh_next; | 518 | gh = gh_next; |
482 | cb (cb_cls, peer); | 519 | cb (cb_cls, peer); |
483 | } | 520 | } |
@@ -497,7 +534,9 @@ transport_peer_connect_notify_cb (void *cls, | |||
497 | { | 534 | { |
498 | struct PooledConnection *entry = cls; | 535 | struct PooledConnection *entry = cls; |
499 | 536 | ||
500 | peer_connect_notify_cb (entry, peer, GST_CONNECTIONPOOL_SERVICE_TRANSPORT); | 537 | peer_connect_notify_cb (entry, |
538 | peer, | ||
539 | GST_CONNECTIONPOOL_SERVICE_TRANSPORT); | ||
501 | } | 540 | } |
502 | 541 | ||
503 | 542 | ||
@@ -637,7 +676,7 @@ opstart_get_handle_core (void *cls) | |||
637 | 676 | ||
638 | 677 | ||
639 | /** | 678 | /** |
640 | * Function called when the operation responsible for opening a TRANSPORT | 679 | * Function called when the operation responsible for opening a CORE |
641 | * connection is marked as done. | 680 | * connection is marked as done. |
642 | * | 681 | * |
643 | * @param cls the #PooledConnection object | 682 | * @param cls the #PooledConnection object |
@@ -657,6 +696,40 @@ oprelease_get_handle_core (void *cls) | |||
657 | 696 | ||
658 | 697 | ||
659 | /** | 698 | /** |
699 | * Function called when resources for opening a connection to ATS are | ||
700 | * available. | ||
701 | * | ||
702 | * @param cls the #PooledConnection object | ||
703 | */ | ||
704 | static void | ||
705 | opstart_get_handle_ats_connectivity (void *cls) | ||
706 | { | ||
707 | struct PooledConnection *entry = cls; | ||
708 | |||
709 | entry->handle_ats_connectivity = | ||
710 | GNUNET_ATS_connectivity_init (entry->cfg); | ||
711 | } | ||
712 | |||
713 | |||
714 | /** | ||
715 | * Function called when the operation responsible for opening a ATS | ||
716 | * connection is marked as done. | ||
717 | * | ||
718 | * @param cls the #PooledConnection object | ||
719 | */ | ||
720 | static void | ||
721 | oprelease_get_handle_ats_connectivity (void *cls) | ||
722 | { | ||
723 | struct PooledConnection *entry = cls; | ||
724 | |||
725 | if (NULL == entry->handle_ats_connectivity) | ||
726 | return; | ||
727 | GNUNET_ATS_connectivity_done (entry->handle_ats_connectivity); | ||
728 | entry->handle_ats_connectivity = NULL; | ||
729 | } | ||
730 | |||
731 | |||
732 | /** | ||
660 | * This function will be called for every #PooledConnection object in @p map | 733 | * This function will be called for every #PooledConnection object in @p map |
661 | * | 734 | * |
662 | * @param cls NULL | 735 | * @param cls NULL |
@@ -798,6 +871,12 @@ GST_connection_pool_get_handle (unsigned int peer_id, | |||
798 | LOG_DEBUG ("Found CORE handle for peer %u\n", | 871 | LOG_DEBUG ("Found CORE handle for peer %u\n", |
799 | entry->index); | 872 | entry->index); |
800 | break; | 873 | break; |
874 | case GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY: | ||
875 | handle = entry->handle_ats_connectivity; | ||
876 | if (NULL != handle) | ||
877 | LOG_DEBUG ("Found ATS CONNECTIVITY handle for peer %u\n", | ||
878 | entry->index); | ||
879 | break; | ||
801 | } | 880 | } |
802 | } | 881 | } |
803 | else | 882 | else |
@@ -863,6 +942,14 @@ GST_connection_pool_get_handle (unsigned int peer_id, | |||
863 | &oprelease_get_handle_core); | 942 | &oprelease_get_handle_core); |
864 | entry->op_core = op; | 943 | entry->op_core = op; |
865 | break; | 944 | break; |
945 | case GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY: | ||
946 | if (NULL != entry->op_ats_connectivity) | ||
947 | return gh; /* Operation pending */ | ||
948 | op = GNUNET_TESTBED_operation_create_ (entry, | ||
949 | &opstart_get_handle_ats_connectivity, | ||
950 | &oprelease_get_handle_ats_connectivity); | ||
951 | entry->op_ats_connectivity = op; | ||
952 | break; | ||
866 | } | 953 | } |
867 | GNUNET_TESTBED_operation_queue_insert_ (GST_opq_openfds, | 954 | GNUNET_TESTBED_operation_queue_insert_ (GST_opq_openfds, |
868 | op); | 955 | op); |
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.h b/src/testbed/gnunet-service-testbed_connectionpool.h index 5d375842c..acc597e9e 100644 --- a/src/testbed/gnunet-service-testbed_connectionpool.h +++ b/src/testbed/gnunet-service-testbed_connectionpool.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2008--2013 Christian Grothoff (and other contributing authors) | 3 | Copyright (C) 2008--2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -23,7 +23,9 @@ | |||
23 | * @brief Interface for connection pooling subroutines | 23 | * @brief Interface for connection pooling subroutines |
24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | 24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> |
25 | */ | 25 | */ |
26 | 26 | #include "gnunet_ats_service.h" | |
27 | #include "gnunet_core_service.h" | ||
28 | #include "gnunet_transport_service.h" | ||
27 | 29 | ||
28 | /** | 30 | /** |
29 | * The request handle for obtaining a pooled connection | 31 | * The request handle for obtaining a pooled connection |
@@ -44,7 +46,12 @@ enum GST_ConnectionPool_Service | |||
44 | /** | 46 | /** |
45 | * Core service | 47 | * Core service |
46 | */ | 48 | */ |
47 | GST_CONNECTIONPOOL_SERVICE_CORE | 49 | GST_CONNECTIONPOOL_SERVICE_CORE, |
50 | |||
51 | /** | ||
52 | * ATS service | ||
53 | */ | ||
54 | GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY | ||
48 | }; | 55 | }; |
49 | 56 | ||
50 | 57 | ||
@@ -63,7 +70,7 @@ GST_connection_pool_init (unsigned int size); | |||
63 | * Cleanup the connection pool | 70 | * Cleanup the connection pool |
64 | */ | 71 | */ |
65 | void | 72 | void |
66 | GST_connection_pool_destroy (); | 73 | GST_connection_pool_destroy (void); |
67 | 74 | ||
68 | /** | 75 | /** |
69 | * Functions of this type are called when the needed handle is available for | 76 | * Functions of this type are called when the needed handle is available for |
@@ -75,15 +82,16 @@ GST_connection_pool_destroy (); | |||
75 | * @param cls the closure passed to GST_connection_pool_get_handle() | 82 | * @param cls the closure passed to GST_connection_pool_get_handle() |
76 | * @param ch the handle to CORE. Can be NULL if it is not requested | 83 | * @param ch the handle to CORE. Can be NULL if it is not requested |
77 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested | 84 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested |
85 | * @param ac the handle to ATS, can be NULL if it is not requested | ||
78 | * @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 |
79 | * cases, its value being NULL means that CORE connection has failed. | 87 | * cases, its value being NULL means that CORE connection has failed. |
80 | */ | 88 | */ |
81 | typedef void | 89 | typedef void |
82 | (*GST_connection_pool_connection_ready_cb) (void *cls, | 90 | (*GST_connection_pool_connection_ready_cb) (void *cls, |
83 | struct GNUNET_CORE_Handle * ch, | 91 | struct GNUNET_CORE_Handle *ch, |
84 | struct GNUNET_TRANSPORT_Handle * th, | 92 | struct GNUNET_TRANSPORT_Handle *th, |
85 | const struct GNUNET_PeerIdentity * | 93 | struct GNUNET_ATS_ConnectivityHandle *ac, |
86 | peer_id); | 94 | const struct GNUNET_PeerIdentity *peer_id); |
87 | 95 | ||
88 | 96 | ||
89 | /** | 97 | /** |
@@ -96,8 +104,7 @@ typedef void | |||
96 | */ | 104 | */ |
97 | typedef void | 105 | typedef void |
98 | (*GST_connection_pool_peer_connect_notify) (void *cls, | 106 | (*GST_connection_pool_peer_connect_notify) (void *cls, |
99 | const struct GNUNET_PeerIdentity | 107 | const struct GNUNET_PeerIdentity *target); |
100 | *target); | ||
101 | 108 | ||
102 | 109 | ||
103 | /** | 110 | /** |
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c index bb3a04e93..ca7f5dd14 100644 --- a/src/testbed/gnunet-service-testbed_oc.c +++ b/src/testbed/gnunet-service-testbed_oc.c | |||
@@ -625,7 +625,8 @@ send_overlay_connect_success_msg (struct OverlayConnectContext *occ) | |||
625 | * @param new_peer the peer that connected | 625 | * @param new_peer the peer that connected |
626 | */ | 626 | */ |
627 | static void | 627 | static void |
628 | overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer) | 628 | overlay_connect_notify (void *cls, |
629 | const struct GNUNET_PeerIdentity *new_peer) | ||
629 | { | 630 | { |
630 | struct OverlayConnectContext *occ = cls; | 631 | struct OverlayConnectContext *occ = cls; |
631 | struct LocalPeer2Context *lp2c; | 632 | struct LocalPeer2Context *lp2c; |
@@ -684,18 +685,20 @@ overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer) | |||
684 | * @param tc the scheduler task context | 685 | * @param tc the scheduler task context |
685 | */ | 686 | */ |
686 | static void | 687 | static void |
687 | try_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 688 | try_connect_task (void *cls, |
689 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
688 | 690 | ||
689 | 691 | ||
690 | /** | 692 | /** |
691 | * Callback to be called with result of the try connect request. | 693 | * Callback to be called with result of the try connect request. |
692 | * | 694 | * |
693 | * @param cls the overlay connect context | 695 | * @param cls the overlay connect context |
694 | * @param result GNUNET_OK if message was transmitted to transport service | 696 | * @param result #GNUNET_OK if message was transmitted to transport service |
695 | * GNUNET_SYSERR if message was not transmitted to transport service | 697 | * #GNUNET_SYSERR if message was not transmitted to transport service |
696 | */ | 698 | */ |
697 | static void | 699 | static void |
698 | try_connect_cb (void *cls, const int result) | 700 | try_connect_cb (void *cls, |
701 | const int result) | ||
699 | { | 702 | { |
700 | struct TryConnectContext *tcc = cls; | 703 | struct TryConnectContext *tcc = cls; |
701 | 704 | ||
@@ -716,7 +719,8 @@ try_connect_cb (void *cls, const int result) | |||
716 | * @param tc the scheduler task context | 719 | * @param tc the scheduler task context |
717 | */ | 720 | */ |
718 | static void | 721 | static void |
719 | try_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 722 | try_connect_task (void *cls, |
723 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
720 | { | 724 | { |
721 | struct TryConnectContext *tcc = cls; | 725 | struct TryConnectContext *tcc = cls; |
722 | 726 | ||
@@ -742,7 +746,8 @@ try_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
742 | * @param tc the TaskContext from scheduler | 746 | * @param tc the TaskContext from scheduler |
743 | */ | 747 | */ |
744 | static void | 748 | static void |
745 | send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 749 | send_hello (void *cls, |
750 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
746 | 751 | ||
747 | 752 | ||
748 | /** | 753 | /** |
@@ -750,11 +755,12 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
750 | * | 755 | * |
751 | * @param cls the overlay connect context | 756 | * @param cls the overlay connect context |
752 | * @param tc the scheduler task context; if tc->reason = | 757 | * @param tc the scheduler task context; if tc->reason = |
753 | * GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if | 758 | * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if |
754 | * GNUNET_SCHEDULER_REASON_READ_READY is succeeded | 759 | * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded |
755 | */ | 760 | */ |
756 | static void | 761 | static void |
757 | occ_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 762 | occ_hello_sent_cb (void *cls, |
763 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
758 | { | 764 | { |
759 | struct OverlayConnectContext *occ = cls; | 765 | struct OverlayConnectContext *occ = cls; |
760 | struct LocalPeer2Context *lp2c; | 766 | struct LocalPeer2Context *lp2c; |
@@ -790,7 +796,7 @@ occ_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
790 | * request. | 796 | * request. |
791 | * | 797 | * |
792 | * @param occ the overlay connect context. Its type must be either | 798 | * @param occ the overlay connect context. Its type must be either |
793 | * OCC_TYPE_REMOTE_SLAVE or OCC_TYPE_REMOTE_LATERAL | 799 | * #OCC_TYPE_REMOTE_SLAVE or #OCC_TYPE_REMOTE_LATERAL |
794 | */ | 800 | */ |
795 | void | 801 | void |
796 | send_hello_thru_rocc (struct OverlayConnectContext *occ) | 802 | send_hello_thru_rocc (struct OverlayConnectContext *occ) |
@@ -877,12 +883,14 @@ send_hello (void *cls, | |||
877 | * @param cls the closure passed to GST_cache_get_handle_transport() | 883 | * @param cls the closure passed to GST_cache_get_handle_transport() |
878 | * @param ch the handle to CORE. Can be NULL if it is not requested | 884 | * @param ch the handle to CORE. Can be NULL if it is not requested |
879 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested | 885 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested |
886 | * @param ac the handle to ATS. Can be NULL if it is not requested | ||
880 | * @param ignore_ peer identity which is ignored in this callback | 887 | * @param ignore_ peer identity which is ignored in this callback |
881 | */ | 888 | */ |
882 | static void | 889 | static void |
883 | p2_transport_connect_cache_callback (void *cls, | 890 | p2_transport_connect_cache_callback (void *cls, |
884 | struct GNUNET_CORE_Handle *ch, | 891 | struct GNUNET_CORE_Handle *ch, |
885 | struct GNUNET_TRANSPORT_Handle *th, | 892 | struct GNUNET_TRANSPORT_Handle *th, |
893 | struct GNUNET_ATS_ConnectivityHandle *ac, | ||
886 | const struct GNUNET_PeerIdentity *ignore_) | 894 | const struct GNUNET_PeerIdentity *ignore_) |
887 | { | 895 | { |
888 | struct OverlayConnectContext *occ = cls; | 896 | struct OverlayConnectContext *occ = cls; |
@@ -1014,11 +1022,14 @@ hello_update_cb (void *cls, | |||
1014 | * @param cls the closure passed to GST_cache_get_handle_transport() | 1022 | * @param cls the closure passed to GST_cache_get_handle_transport() |
1015 | * @param ch the handle to CORE. Can be NULL if it is not requested | 1023 | * @param ch the handle to CORE. Can be NULL if it is not requested |
1016 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested | 1024 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested |
1025 | * @param ac the handle to ATS. Can be NULL if it is not requested | ||
1017 | * @param ignore_ peer identity which is ignored in this callback | 1026 | * @param ignore_ peer identity which is ignored in this callback |
1018 | */ | 1027 | */ |
1019 | static void | 1028 | static void |
1020 | p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | 1029 | p1_transport_connect_cache_callback (void *cls, |
1030 | struct GNUNET_CORE_Handle *ch, | ||
1021 | struct GNUNET_TRANSPORT_Handle *th, | 1031 | struct GNUNET_TRANSPORT_Handle *th, |
1032 | struct GNUNET_ATS_ConnectivityHandle *ac, | ||
1022 | const struct GNUNET_PeerIdentity *ignore_) | 1033 | const struct GNUNET_PeerIdentity *ignore_) |
1023 | { | 1034 | { |
1024 | struct OverlayConnectContext *occ = cls; | 1035 | struct OverlayConnectContext *occ = cls; |
@@ -1055,12 +1066,14 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1055 | * @param cls the closure passed to GST_cache_get_handle_transport() | 1066 | * @param cls the closure passed to GST_cache_get_handle_transport() |
1056 | * @param ch the handle to CORE. Can be NULL if it is not requested | 1067 | * @param ch the handle to CORE. Can be NULL if it is not requested |
1057 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested | 1068 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested |
1069 | * @param ac the handle to ATS. Can be NULL if it is not requested | ||
1058 | * @param my_identity the identity of our peer | 1070 | * @param my_identity the identity of our peer |
1059 | */ | 1071 | */ |
1060 | static void | 1072 | static void |
1061 | occ_cache_get_handle_core_cb (void *cls, | 1073 | occ_cache_get_handle_core_cb (void *cls, |
1062 | struct GNUNET_CORE_Handle *ch, | 1074 | struct GNUNET_CORE_Handle *ch, |
1063 | struct GNUNET_TRANSPORT_Handle *th, | 1075 | struct GNUNET_TRANSPORT_Handle *th, |
1076 | struct GNUNET_ATS_ConnectivityHandle *ac, | ||
1064 | const struct GNUNET_PeerIdentity *my_identity) | 1077 | const struct GNUNET_PeerIdentity *my_identity) |
1065 | { | 1078 | { |
1066 | struct OverlayConnectContext *occ = cls; | 1079 | struct OverlayConnectContext *occ = cls; |
@@ -1244,7 +1257,8 @@ hash_hosts (struct GNUNET_TESTBED_Host *reg_host, | |||
1244 | * already registered, NULL is returned. | 1257 | * already registered, NULL is returned. |
1245 | */ | 1258 | */ |
1246 | static struct RegisteredHostContext * | 1259 | static struct RegisteredHostContext * |
1247 | register_host (struct Slave *slave, struct GNUNET_TESTBED_Host *host) | 1260 | register_host (struct Slave *slave, |
1261 | struct GNUNET_TESTBED_Host *host) | ||
1248 | { | 1262 | { |
1249 | struct GNUNET_HashCode hash; | 1263 | struct GNUNET_HashCode hash; |
1250 | struct RegisteredHostContext *rhc; | 1264 | struct RegisteredHostContext *rhc; |
@@ -1357,9 +1371,12 @@ forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg, | |||
1357 | &GST_forwarded_operation_reply_relay, | 1371 | &GST_forwarded_operation_reply_relay, |
1358 | fopc); | 1372 | fopc); |
1359 | fopc->timeout_task = | 1373 | fopc->timeout_task = |
1360 | GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout, | 1374 | GNUNET_SCHEDULER_add_delayed (GST_timeout, |
1375 | &GST_forwarded_operation_timeout, | ||
1376 | fopc); | ||
1377 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, | ||
1378 | fopcq_tail, | ||
1361 | fopc); | 1379 | fopc); |
1362 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); | ||
1363 | } | 1380 | } |
1364 | 1381 | ||
1365 | 1382 | ||
@@ -1640,7 +1657,8 @@ attempt_connect_task (void *cls, | |||
1640 | * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded | 1657 | * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded |
1641 | */ | 1658 | */ |
1642 | static void | 1659 | static void |
1643 | rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1660 | rocc_hello_sent_cb (void *cls, |
1661 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1644 | { | 1662 | { |
1645 | struct RemoteOverlayConnectCtx *rocc = cls; | 1663 | struct RemoteOverlayConnectCtx *rocc = cls; |
1646 | 1664 | ||
@@ -1672,7 +1690,8 @@ rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1672 | * @param tc the TaskContext from scheduler | 1690 | * @param tc the TaskContext from scheduler |
1673 | */ | 1691 | */ |
1674 | static void | 1692 | static void |
1675 | attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1693 | attempt_connect_task (void *cls, |
1694 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1676 | { | 1695 | { |
1677 | struct RemoteOverlayConnectCtx *rocc = cls; | 1696 | struct RemoteOverlayConnectCtx *rocc = cls; |
1678 | 1697 | ||
@@ -1700,11 +1719,14 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1700 | * @param cls the closure passed to GST_cache_get_handle_transport() | 1719 | * @param cls the closure passed to GST_cache_get_handle_transport() |
1701 | * @param ch the handle to CORE. Can be NULL if it is not requested | 1720 | * @param ch the handle to CORE. Can be NULL if it is not requested |
1702 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested | 1721 | * @param th the handle to TRANSPORT. Can be NULL if it is not requested |
1722 | * @param ac the handle to ATS. Can be NULL if it is not requested | ||
1703 | * @param ignore_ peer identity which is ignored in this callback | 1723 | * @param ignore_ peer identity which is ignored in this callback |
1704 | */ | 1724 | */ |
1705 | static void | 1725 | static void |
1706 | rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, | 1726 | rocc_cache_get_handle_transport_cb (void *cls, |
1727 | struct GNUNET_CORE_Handle *ch, | ||
1707 | struct GNUNET_TRANSPORT_Handle *th, | 1728 | struct GNUNET_TRANSPORT_Handle *th, |
1729 | struct GNUNET_ATS_ConnectivityHandle *ac, | ||
1708 | const struct GNUNET_PeerIdentity *ignore_) | 1730 | const struct GNUNET_PeerIdentity *ignore_) |
1709 | { | 1731 | { |
1710 | struct RemoteOverlayConnectCtx *rocc = cls; | 1732 | struct RemoteOverlayConnectCtx *rocc = cls; |
@@ -1718,7 +1740,8 @@ rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1718 | rocc->tcc.th_ = th; | 1740 | rocc->tcc.th_ = th; |
1719 | rocc->tcc.pid = &rocc->a_id; | 1741 | rocc->tcc.pid = &rocc->a_id; |
1720 | if (GNUNET_YES == | 1742 | if (GNUNET_YES == |
1721 | GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, rocc->tcc.pid)) | 1743 | GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, |
1744 | rocc->tcc.pid)) | ||
1722 | { | 1745 | { |
1723 | LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n", | 1746 | LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n", |
1724 | rocc->op_id, | 1747 | rocc->op_id, |