diff options
-rw-r--r-- | src/core/test_core_api.c | 11 | ||||
-rw-r--r-- | src/core/test_core_api_preferences.c | 11 | ||||
-rw-r--r-- | src/core/test_core_api_reliability.c | 11 | ||||
-rw-r--r-- | src/core/test_core_quota_compliance.c | 11 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht.c | 13 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist.c | 5 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_reconnect.c | 5 | ||||
-rw-r--r-- | src/include/gnunet_testing_lib.h | 9 | ||||
-rw-r--r-- | src/include/gnunet_transport_service.h | 17 | ||||
-rw-r--r-- | src/mesh/mesh_api.c | 2 | ||||
-rw-r--r-- | src/nat/test_nat_test.c | 14 | ||||
-rw-r--r-- | src/testing/testing.c | 35 | ||||
-rw-r--r-- | src/transport/Makefile.am | 5 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 3 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 4 | ||||
-rw-r--r-- | src/transport/test_quota_compliance.c | 8 | ||||
-rw-r--r-- | src/transport/test_transport_api_disconnect.c | 12 | ||||
-rw-r--r-- | src/transport/transport-testing.c | 13 | ||||
-rw-r--r-- | src/transport/transport-testing.h | 2 | ||||
-rw-r--r-- | src/transport/transport_api.c | 56 |
20 files changed, 135 insertions, 112 deletions
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 28805a372..894e4f642 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -46,6 +46,7 @@ struct PeerContext | |||
46 | struct GNUNET_CORE_Handle *ch; | 46 | struct GNUNET_CORE_Handle *ch; |
47 | struct GNUNET_PeerIdentity id; | 47 | struct GNUNET_PeerIdentity id; |
48 | struct GNUNET_TRANSPORT_Handle *th; | 48 | struct GNUNET_TRANSPORT_Handle *th; |
49 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
49 | struct GNUNET_MessageHeader *hello; | 50 | struct GNUNET_MessageHeader *hello; |
50 | int connect_status; | 51 | int connect_status; |
51 | #if START_ARM | 52 | #if START_ARM |
@@ -91,8 +92,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
91 | GNUNET_assert (ok == 6); | 92 | GNUNET_assert (ok == 6); |
92 | GNUNET_CORE_disconnect (p1.ch); | 93 | GNUNET_CORE_disconnect (p1.ch); |
93 | GNUNET_CORE_disconnect (p2.ch); | 94 | GNUNET_CORE_disconnect (p2.ch); |
94 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 95 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
95 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 96 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
96 | GNUNET_TRANSPORT_disconnect (p1.th); | 97 | GNUNET_TRANSPORT_disconnect (p1.th); |
97 | GNUNET_TRANSPORT_disconnect (p2.th); | 98 | GNUNET_TRANSPORT_disconnect (p2.th); |
98 | ok = 0; | 99 | ok = 0; |
@@ -118,13 +119,13 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
118 | } | 119 | } |
119 | if (p1.th != NULL) | 120 | if (p1.th != NULL) |
120 | { | 121 | { |
121 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 122 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
122 | GNUNET_TRANSPORT_disconnect (p1.th); | 123 | GNUNET_TRANSPORT_disconnect (p1.th); |
123 | p1.th = NULL; | 124 | p1.th = NULL; |
124 | } | 125 | } |
125 | if (p2.th != NULL) | 126 | if (p2.th != NULL) |
126 | { | 127 | { |
127 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 128 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
128 | GNUNET_TRANSPORT_disconnect (p2.th); | 129 | GNUNET_TRANSPORT_disconnect (p2.th); |
129 | p2.th = NULL; | 130 | p2.th = NULL; |
130 | } | 131 | } |
@@ -312,7 +313,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
312 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 313 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
313 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); | 314 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); |
314 | GNUNET_assert (p->th != NULL); | 315 | GNUNET_assert (p->th != NULL); |
315 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); | 316 | p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); |
316 | } | 317 | } |
317 | 318 | ||
318 | 319 | ||
diff --git a/src/core/test_core_api_preferences.c b/src/core/test_core_api_preferences.c index 8bc977df2..d3364463a 100644 --- a/src/core/test_core_api_preferences.c +++ b/src/core/test_core_api_preferences.c | |||
@@ -43,6 +43,7 @@ struct PeerContext | |||
43 | struct GNUNET_CORE_Handle *ch; | 43 | struct GNUNET_CORE_Handle *ch; |
44 | struct GNUNET_PeerIdentity id; | 44 | struct GNUNET_PeerIdentity id; |
45 | struct GNUNET_TRANSPORT_Handle *th; | 45 | struct GNUNET_TRANSPORT_Handle *th; |
46 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
46 | struct GNUNET_MessageHeader *hello; | 47 | struct GNUNET_MessageHeader *hello; |
47 | int connect_status; | 48 | int connect_status; |
48 | #if START_ARM | 49 | #if START_ARM |
@@ -86,8 +87,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
86 | #endif | 87 | #endif |
87 | GNUNET_assert (ok == 6); | 88 | GNUNET_assert (ok == 6); |
88 | GNUNET_assert (NULL == irc); | 89 | GNUNET_assert (NULL == irc); |
89 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 90 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
90 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 91 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
91 | GNUNET_CORE_disconnect (p1.ch); | 92 | GNUNET_CORE_disconnect (p1.ch); |
92 | GNUNET_CORE_disconnect (p2.ch); | 93 | GNUNET_CORE_disconnect (p2.ch); |
93 | GNUNET_TRANSPORT_disconnect (p1.th); | 94 | GNUNET_TRANSPORT_disconnect (p1.th); |
@@ -119,8 +120,8 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
119 | GNUNET_SCHEDULER_cancel (ask_task); | 120 | GNUNET_SCHEDULER_cancel (ask_task); |
120 | ask_task = GNUNET_SCHEDULER_NO_TASK; | 121 | ask_task = GNUNET_SCHEDULER_NO_TASK; |
121 | } | 122 | } |
122 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 123 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
123 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 124 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
124 | GNUNET_CORE_disconnect (p1.ch); | 125 | GNUNET_CORE_disconnect (p1.ch); |
125 | GNUNET_CORE_disconnect (p2.ch); | 126 | GNUNET_CORE_disconnect (p2.ch); |
126 | GNUNET_TRANSPORT_disconnect (p1.th); | 127 | GNUNET_TRANSPORT_disconnect (p1.th); |
@@ -425,7 +426,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
425 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 426 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
426 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); | 427 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); |
427 | GNUNET_assert (p->th != NULL); | 428 | GNUNET_assert (p->th != NULL); |
428 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); | 429 | p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); |
429 | } | 430 | } |
430 | 431 | ||
431 | 432 | ||
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index 47d1ae8ac..ad6e6a761 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -74,6 +74,7 @@ struct PeerContext | |||
74 | struct GNUNET_PeerIdentity id; | 74 | struct GNUNET_PeerIdentity id; |
75 | struct GNUNET_TRANSPORT_Handle *th; | 75 | struct GNUNET_TRANSPORT_Handle *th; |
76 | struct GNUNET_MessageHeader *hello; | 76 | struct GNUNET_MessageHeader *hello; |
77 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
77 | int connect_status; | 78 | int connect_status; |
78 | #if START_ARM | 79 | #if START_ARM |
79 | struct GNUNET_OS_Process *arm_proc; | 80 | struct GNUNET_OS_Process *arm_proc; |
@@ -121,8 +122,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
121 | { | 122 | { |
122 | unsigned long long delta; | 123 | unsigned long long delta; |
123 | 124 | ||
124 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 125 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
125 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 126 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
126 | GNUNET_CORE_disconnect (p1.ch); | 127 | GNUNET_CORE_disconnect (p1.ch); |
127 | p1.ch = NULL; | 128 | p1.ch = NULL; |
128 | GNUNET_CORE_disconnect (p2.ch); | 129 | GNUNET_CORE_disconnect (p2.ch); |
@@ -156,13 +157,13 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
156 | } | 157 | } |
157 | if (p1.th != NULL) | 158 | if (p1.th != NULL) |
158 | { | 159 | { |
159 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 160 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
160 | GNUNET_TRANSPORT_disconnect (p1.th); | 161 | GNUNET_TRANSPORT_disconnect (p1.th); |
161 | p1.th = NULL; | 162 | p1.th = NULL; |
162 | } | 163 | } |
163 | if (p2.th != NULL) | 164 | if (p2.th != NULL) |
164 | { | 165 | { |
165 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 166 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
166 | GNUNET_TRANSPORT_disconnect (p2.th); | 167 | GNUNET_TRANSPORT_disconnect (p2.th); |
167 | p2.th = NULL; | 168 | p2.th = NULL; |
168 | } | 169 | } |
@@ -436,7 +437,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
436 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 437 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
437 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); | 438 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); |
438 | GNUNET_assert (p->th != NULL); | 439 | GNUNET_assert (p->th != NULL); |
439 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); | 440 | p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); |
440 | } | 441 | } |
441 | 442 | ||
442 | 443 | ||
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 41d156c6b..d955e0fd0 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -81,6 +81,7 @@ struct PeerContext | |||
81 | struct GNUNET_TRANSPORT_Handle *th; | 81 | struct GNUNET_TRANSPORT_Handle *th; |
82 | struct GNUNET_MessageHeader *hello; | 82 | struct GNUNET_MessageHeader *hello; |
83 | struct GNUNET_STATISTICS_Handle *stats; | 83 | struct GNUNET_STATISTICS_Handle *stats; |
84 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
84 | int connect_status; | 85 | int connect_status; |
85 | #if START_ARM | 86 | #if START_ARM |
86 | struct GNUNET_OS_Process *arm_proc; | 87 | struct GNUNET_OS_Process *arm_proc; |
@@ -122,8 +123,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
122 | { | 123 | { |
123 | struct GNUNET_CORE_Handle *ch; | 124 | struct GNUNET_CORE_Handle *ch; |
124 | 125 | ||
125 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 126 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
126 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 127 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
127 | ch = p1.ch; | 128 | ch = p1.ch; |
128 | p1.ch = NULL; | 129 | p1.ch = NULL; |
129 | GNUNET_CORE_disconnect (ch); | 130 | GNUNET_CORE_disconnect (ch); |
@@ -147,8 +148,8 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
147 | if (measure_task != GNUNET_SCHEDULER_NO_TASK) | 148 | if (measure_task != GNUNET_SCHEDULER_NO_TASK) |
148 | GNUNET_SCHEDULER_cancel (measure_task); | 149 | GNUNET_SCHEDULER_cancel (measure_task); |
149 | 150 | ||
150 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &process_hello, &p1); | 151 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
151 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &process_hello, &p2); | 152 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
152 | 153 | ||
153 | GNUNET_CORE_disconnect (p1.ch); | 154 | GNUNET_CORE_disconnect (p1.ch); |
154 | p1.ch = NULL; | 155 | p1.ch = NULL; |
@@ -563,7 +564,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
563 | GNUNET_assert (p->stats != NULL); | 564 | GNUNET_assert (p->stats != NULL); |
564 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); | 565 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL); |
565 | GNUNET_assert (p->th != NULL); | 566 | GNUNET_assert (p->th != NULL); |
566 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); | 567 | p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); |
567 | } | 568 | } |
568 | 569 | ||
569 | 570 | ||
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index cbeecb5cc..b864e39e3 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -782,6 +782,10 @@ static struct GNUNET_DATACACHE_Handle *datacache; | |||
782 | */ | 782 | */ |
783 | struct GNUNET_STATISTICS_Handle *stats; | 783 | struct GNUNET_STATISTICS_Handle *stats; |
784 | 784 | ||
785 | /** | ||
786 | * Handle to get our current HELLO. | ||
787 | */ | ||
788 | static struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
785 | 789 | ||
786 | /** | 790 | /** |
787 | * The configuration the DHT service is running with | 791 | * The configuration the DHT service is running with |
@@ -5001,11 +5005,16 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5001 | int bucket_count; | 5005 | int bucket_count; |
5002 | struct PeerInfo *pos; | 5006 | struct PeerInfo *pos; |
5003 | 5007 | ||
5008 | if (NULL != ghh) | ||
5009 | { | ||
5010 | GNUNET_TRANSPORT_get_hello_cancel (ghh); | ||
5011 | ghh = NULL; | ||
5012 | } | ||
5004 | if (transport_handle != NULL) | 5013 | if (transport_handle != NULL) |
5005 | { | 5014 | { |
5006 | GNUNET_free_non_null (my_hello); | 5015 | GNUNET_free_non_null (my_hello); |
5007 | GNUNET_TRANSPORT_get_hello_cancel (transport_handle, &process_hello, NULL); | ||
5008 | GNUNET_TRANSPORT_disconnect (transport_handle); | 5016 | GNUNET_TRANSPORT_disconnect (transport_handle); |
5017 | transport_handle = NULL; | ||
5009 | } | 5018 | } |
5010 | if (coreAPI != NULL) | 5019 | if (coreAPI != NULL) |
5011 | { | 5020 | { |
@@ -5304,7 +5313,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
5304 | transport_handle = | 5313 | transport_handle = |
5305 | GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL); | 5314 | GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL); |
5306 | if (transport_handle != NULL) | 5315 | if (transport_handle != NULL) |
5307 | GNUNET_TRANSPORT_get_hello (transport_handle, &process_hello, NULL); | 5316 | ghh = GNUNET_TRANSPORT_get_hello (transport_handle, &process_hello, NULL); |
5308 | else | 5317 | else |
5309 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 5318 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
5310 | "Failed to connect to transport service!\n"); | 5319 | "Failed to connect to transport service!\n"); |
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index 909b946e7..b6d0a1736 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c | |||
@@ -46,6 +46,7 @@ struct PeerContext | |||
46 | struct GNUNET_CONFIGURATION_Handle *cfg; | 46 | struct GNUNET_CONFIGURATION_Handle *cfg; |
47 | struct GNUNET_TRANSPORT_Handle *th; | 47 | struct GNUNET_TRANSPORT_Handle *th; |
48 | struct GNUNET_MessageHeader *hello; | 48 | struct GNUNET_MessageHeader *hello; |
49 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
49 | #if START_ARM | 50 | #if START_ARM |
50 | struct GNUNET_OS_Process *arm_proc; | 51 | struct GNUNET_OS_Process *arm_proc; |
51 | #endif | 52 | #endif |
@@ -117,7 +118,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
117 | { | 118 | { |
118 | struct PeerContext *p = cls; | 119 | struct PeerContext *p = cls; |
119 | 120 | ||
120 | GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p); | 121 | GNUNET_TRANSPORT_get_hello_cancel (p->ghh); |
121 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 122 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
122 | "Received HELLO, starting hostlist service.\n"); | 123 | "Received HELLO, starting hostlist service.\n"); |
123 | } | 124 | } |
@@ -140,7 +141,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
140 | p->th = | 141 | p->th = |
141 | GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, ¬ify_connect, NULL); | 142 | GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, ¬ify_connect, NULL); |
142 | GNUNET_assert (p->th != NULL); | 143 | GNUNET_assert (p->th != NULL); |
143 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); | 144 | p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); |
144 | } | 145 | } |
145 | 146 | ||
146 | 147 | ||
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c index ff625cf8e..078c2a54e 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c | |||
@@ -47,6 +47,7 @@ struct PeerContext | |||
47 | struct GNUNET_CONFIGURATION_Handle *cfg; | 47 | struct GNUNET_CONFIGURATION_Handle *cfg; |
48 | struct GNUNET_TRANSPORT_Handle *th; | 48 | struct GNUNET_TRANSPORT_Handle *th; |
49 | struct GNUNET_MessageHeader *hello; | 49 | struct GNUNET_MessageHeader *hello; |
50 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
50 | #if START_ARM | 51 | #if START_ARM |
51 | struct GNUNET_OS_Process *arm_proc; | 52 | struct GNUNET_OS_Process *arm_proc; |
52 | #endif | 53 | #endif |
@@ -121,7 +122,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
121 | { | 122 | { |
122 | struct PeerContext *p = cls; | 123 | struct PeerContext *p = cls; |
123 | 124 | ||
124 | GNUNET_TRANSPORT_get_hello_cancel (p->th, &process_hello, p); | 125 | GNUNET_TRANSPORT_get_hello_cancel (p->ghh); |
125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
126 | "Received HELLO, starting hostlist service.\n"); | 127 | "Received HELLO, starting hostlist service.\n"); |
127 | } | 128 | } |
@@ -144,7 +145,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
144 | p->th = | 145 | p->th = |
145 | GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, ¬ify_connect, NULL); | 146 | GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, ¬ify_connect, NULL); |
146 | GNUNET_assert (p->th != NULL); | 147 | GNUNET_assert (p->th != NULL); |
147 | GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); | 148 | p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); |
148 | } | 149 | } |
149 | 150 | ||
150 | 151 | ||
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 786522cdd..945a3900b 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -319,6 +319,11 @@ struct GNUNET_TESTING_Daemon | |||
319 | struct GNUNET_TRANSPORT_Handle *th; | 319 | struct GNUNET_TRANSPORT_Handle *th; |
320 | 320 | ||
321 | /** | 321 | /** |
322 | * Handle for getting HELLOs from transport | ||
323 | */ | ||
324 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
325 | |||
326 | /** | ||
322 | * HELLO message for this peer | 327 | * HELLO message for this peer |
323 | */ | 328 | */ |
324 | struct GNUNET_HELLO_Message *hello; | 329 | struct GNUNET_HELLO_Message *hello; |
@@ -723,7 +728,7 @@ GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg); | |||
723 | * @param cb function to call at the end | 728 | * @param cb function to call at the end |
724 | * @param cb_cls closure for cb | 729 | * @param cb_cls closure for cb |
725 | */ | 730 | */ |
726 | struct GNUNET_TESTING_ConnectContext * | 731 | void /* struct GNUNET_TESTING_ConnectContext * */ |
727 | GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | 732 | GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, |
728 | struct GNUNET_TESTING_Daemon *d2, | 733 | struct GNUNET_TESTING_Daemon *d2, |
729 | struct GNUNET_TIME_Relative timeout, | 734 | struct GNUNET_TIME_Relative timeout, |
@@ -733,6 +738,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
733 | void *cb_cls); | 738 | void *cb_cls); |
734 | 739 | ||
735 | 740 | ||
741 | #if 0 | ||
736 | /** | 742 | /** |
737 | * Cancel an attempt to connect two daemons. | 743 | * Cancel an attempt to connect two daemons. |
738 | * | 744 | * |
@@ -741,6 +747,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
741 | void | 747 | void |
742 | GNUNET_TESTING_daemons_connect_cancel (struct GNUNET_TESTING_ConnectContext | 748 | GNUNET_TESTING_daemons_connect_cancel (struct GNUNET_TESTING_ConnectContext |
743 | *cc); | 749 | *cc); |
750 | #endif | ||
744 | 751 | ||
745 | 752 | ||
746 | /** | 753 | /** |
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index e90acab4d..84a13ed68 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -573,13 +573,20 @@ typedef void (*GNUNET_TRANSPORT_HelloUpdateCallback) (void *cls, | |||
573 | 573 | ||
574 | 574 | ||
575 | /** | 575 | /** |
576 | * Handle to cancel a 'GNUNET_TRANSPORT_get_hello' operation. | ||
577 | */ | ||
578 | struct GNUNET_TRANSPORT_GetHelloHandle; | ||
579 | |||
580 | |||
581 | /** | ||
576 | * Obtain updates on changes to the HELLO message for this peer. | 582 | * Obtain updates on changes to the HELLO message for this peer. |
577 | * | 583 | * |
578 | * @param handle connection to transport service | 584 | * @param handle connection to transport service |
579 | * @param rec function to call with the HELLO | 585 | * @param rec function to call with the HELLO |
580 | * @param rec_cls closure for rec | 586 | * @param rec_cls closure for rec |
587 | * @return handle to cancel the operation, NULL on error | ||
581 | */ | 588 | */ |
582 | void | 589 | struct GNUNET_TRANSPORT_GetHelloHandle * |
583 | GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, | 590 | GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, |
584 | GNUNET_TRANSPORT_HelloUpdateCallback rec, | 591 | GNUNET_TRANSPORT_HelloUpdateCallback rec, |
585 | void *rec_cls); | 592 | void *rec_cls); |
@@ -588,14 +595,10 @@ GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
588 | /** | 595 | /** |
589 | * Stop receiving updates about changes to our HELLO message. | 596 | * Stop receiving updates about changes to our HELLO message. |
590 | * | 597 | * |
591 | * @param handle connection to transport service | 598 | * @param ghh handle returned from 'GNUNET_TRANSPORT_get_hello') |
592 | * @param rec function previously registered to be called with the HELLOs | ||
593 | * @param rec_cls closure for rec | ||
594 | */ | 599 | */ |
595 | void | 600 | void |
596 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_Handle *handle, | 601 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh); |
597 | GNUNET_TRANSPORT_HelloUpdateCallback rec, | ||
598 | void *rec_cls); | ||
599 | 602 | ||
600 | 603 | ||
601 | /** | 604 | /** |
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 615593621..8476be396 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -921,4 +921,4 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) | |||
921 | GNUNET_free (handle); | 921 | GNUNET_free (handle); |
922 | } | 922 | } |
923 | 923 | ||
924 | /* end of mesh_api.c */ \ No newline at end of file | 924 | /* end of mesh_api.c */ |
diff --git a/src/nat/test_nat_test.c b/src/nat/test_nat_test.c index 5a716bd8e..1b4d1bc1d 100644 --- a/src/nat/test_nat_test.c +++ b/src/nat/test_nat_test.c | |||
@@ -111,18 +111,14 @@ main (int argc, char *const argv[]) | |||
111 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); | 111 | nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); |
112 | if (GNUNET_NO == nat_res) | 112 | if (GNUNET_NO == nat_res) |
113 | { | 113 | { |
114 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 114 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
115 | "Cannot run NAT test: `%s' %s \n", | 115 | "gnunet-nat-server", "SUID not set"); |
116 | "gnunet-nat-server", | ||
117 | "SUID not set"); | ||
118 | return 0; | 116 | return 0; |
119 | } | 117 | } |
120 | if (GNUNET_SYSERR == nat_res) | 118 | if (GNUNET_SYSERR == nat_res) |
121 | { | 119 | { |
122 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 120 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n", |
123 | "Cannot run NAT test: `%s' %s \n", | 121 | "gnunet-nat-server", "file not found"); |
124 | "gnunet-nat-server", | ||
125 | "file not found"); | ||
126 | return 0; | 122 | return 0; |
127 | } | 123 | } |
128 | 124 | ||
diff --git a/src/testing/testing.c b/src/testing/testing.c index 3a712f071..5eaa0a12b 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -137,9 +137,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
137 | { | 137 | { |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | if (daemon->th != NULL) | 140 | if (daemon->ghh != NULL) |
141 | { | 141 | { |
142 | GNUNET_TRANSPORT_get_hello_cancel (daemon->th, &process_hello, daemon); | 142 | GNUNET_TRANSPORT_get_hello_cancel (daemon->ghh); |
143 | } | 143 | } |
144 | #if DEBUG_TESTING | 144 | #if DEBUG_TESTING |
145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -246,7 +246,7 @@ testing_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
246 | GNUNET_i2s (my_identity)); | 246 | GNUNET_i2s (my_identity)); |
247 | #endif | 247 | #endif |
248 | 248 | ||
249 | GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); | 249 | d->ghh = GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); |
250 | /* wait some more */ | 250 | /* wait some more */ |
251 | if (d->task != GNUNET_SCHEDULER_NO_TASK) | 251 | if (d->task != GNUNET_SCHEDULER_NO_TASK) |
252 | GNUNET_SCHEDULER_cancel (d->task); | 252 | GNUNET_SCHEDULER_cancel (d->task); |
@@ -706,7 +706,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
706 | GNUNET_i2s (&d->id)); | 706 | GNUNET_i2s (&d->id)); |
707 | #endif | 707 | #endif |
708 | 708 | ||
709 | GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); | 709 | d->ghh = GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); |
710 | GNUNET_SCHEDULER_add_now (¬ify_daemon_started, d); | 710 | GNUNET_SCHEDULER_add_now (¬ify_daemon_started, d); |
711 | /*cb = d->cb; | 711 | /*cb = d->cb; |
712 | * d->cb = NULL; | 712 | * d->cb = NULL; |
@@ -836,7 +836,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
836 | ("either `gnunet-arm' or `ssh' does not seem to terminate.\n")); | 836 | ("either `gnunet-arm' or `ssh' does not seem to terminate.\n")); |
837 | if (d->th != NULL) | 837 | if (d->th != NULL) |
838 | { | 838 | { |
839 | GNUNET_TRANSPORT_get_hello_cancel (d->th, &process_hello, d); | 839 | GNUNET_TRANSPORT_get_hello_cancel (d->ghh); |
840 | d->ghh = NULL; | ||
840 | GNUNET_TRANSPORT_disconnect (d->th); | 841 | GNUNET_TRANSPORT_disconnect (d->th); |
841 | d->th = NULL; | 842 | d->th = NULL; |
842 | } | 843 | } |
@@ -865,7 +866,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
865 | ("shutdown (either `gnunet-arm' or `ssh') did not complete cleanly.\n")); | 866 | ("shutdown (either `gnunet-arm' or `ssh') did not complete cleanly.\n")); |
866 | if (d->th != NULL) | 867 | if (d->th != NULL) |
867 | { | 868 | { |
868 | GNUNET_TRANSPORT_get_hello_cancel (d->th, &process_hello, d); | 869 | GNUNET_TRANSPORT_get_hello_cancel (d->ghh); |
870 | d->ghh = NULL; | ||
869 | GNUNET_TRANSPORT_disconnect (d->th); | 871 | GNUNET_TRANSPORT_disconnect (d->th); |
870 | d->th = NULL; | 872 | d->th = NULL; |
871 | } | 873 | } |
@@ -896,7 +898,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
896 | 898 | ||
897 | if (d->th != NULL) | 899 | if (d->th != NULL) |
898 | { | 900 | { |
899 | GNUNET_TRANSPORT_get_hello_cancel (d->th, &process_hello, d); | 901 | GNUNET_TRANSPORT_get_hello_cancel (d->ghh); |
902 | d->ghh = NULL; | ||
900 | GNUNET_TRANSPORT_disconnect (d->th); | 903 | GNUNET_TRANSPORT_disconnect (d->th); |
901 | d->th = NULL; | 904 | d->th = NULL; |
902 | } | 905 | } |
@@ -1473,7 +1476,8 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | |||
1473 | 1476 | ||
1474 | if (d->th != NULL) | 1477 | if (d->th != NULL) |
1475 | { | 1478 | { |
1476 | GNUNET_TRANSPORT_get_hello_cancel (d->th, &process_hello, d); | 1479 | GNUNET_TRANSPORT_get_hello_cancel (d->ghh); |
1480 | d->ghh = NULL; | ||
1477 | GNUNET_TRANSPORT_disconnect (d->th); | 1481 | GNUNET_TRANSPORT_disconnect (d->th); |
1478 | d->th = NULL; | 1482 | d->th = NULL; |
1479 | } | 1483 | } |
@@ -1715,7 +1719,8 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1715 | d->churn = GNUNET_YES; | 1719 | d->churn = GNUNET_YES; |
1716 | if (d->th != NULL) | 1720 | if (d->th != NULL) |
1717 | { | 1721 | { |
1718 | GNUNET_TRANSPORT_get_hello_cancel (d->th, &process_hello, d); | 1722 | GNUNET_TRANSPORT_get_hello_cancel (d->ghh); |
1723 | d->ghh = NULL; | ||
1719 | GNUNET_TRANSPORT_disconnect (d->th); | 1724 | GNUNET_TRANSPORT_disconnect (d->th); |
1720 | d->th = NULL; | 1725 | d->th = NULL; |
1721 | } | 1726 | } |
@@ -2215,14 +2220,16 @@ reattempt_daemons_connect (void *cls, | |||
2215 | ctx->d2->hello = NULL; | 2220 | ctx->d2->hello = NULL; |
2216 | if (NULL != ctx->d2->th) | 2221 | if (NULL != ctx->d2->th) |
2217 | { | 2222 | { |
2218 | GNUNET_TRANSPORT_get_hello_cancel (ctx->d2->th, &process_hello, ctx->d2); | 2223 | GNUNET_TRANSPORT_get_hello_cancel (ctx->d2->ghh); |
2224 | ctx->d2->ghh = NULL; | ||
2219 | GNUNET_TRANSPORT_disconnect (ctx->d2->th); | 2225 | GNUNET_TRANSPORT_disconnect (ctx->d2->th); |
2220 | } | 2226 | } |
2221 | ctx->d2->th = | 2227 | ctx->d2->th = |
2222 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, | 2228 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, |
2223 | NULL); | 2229 | NULL); |
2224 | GNUNET_assert (ctx->d2->th != NULL); | 2230 | GNUNET_assert (ctx->d2->th != NULL); |
2225 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | 2231 | ctx->d2->ghh = |
2232 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | ||
2226 | } | 2233 | } |
2227 | 2234 | ||
2228 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) | 2235 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) |
@@ -2240,7 +2247,8 @@ reattempt_daemons_connect (void *cls, | |||
2240 | _("Failed to connect to transport service!\n")); | 2247 | _("Failed to connect to transport service!\n")); |
2241 | return; | 2248 | return; |
2242 | } | 2249 | } |
2243 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | 2250 | ctx->d2->ghh = |
2251 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | ||
2244 | } | 2252 | } |
2245 | 2253 | ||
2246 | if (ctx->send_hello == GNUNET_YES) | 2254 | if (ctx->send_hello == GNUNET_YES) |
@@ -2342,7 +2350,8 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2342 | _("Failed to connect to transport service!\n")); | 2350 | _("Failed to connect to transport service!\n")); |
2343 | return; | 2351 | return; |
2344 | } | 2352 | } |
2345 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | 2353 | ctx->d2->ghh = |
2354 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | ||
2346 | } | 2355 | } |
2347 | 2356 | ||
2348 | if (ctx->send_hello == GNUNET_YES) | 2357 | if (ctx->send_hello == GNUNET_YES) |
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index bfe717958..c9bc8c440 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -69,7 +69,7 @@ noinst_PROGRAMS = $(WLAN_BIN_DUMMY) | |||
69 | lib_LTLIBRARIES = \ | 69 | lib_LTLIBRARIES = \ |
70 | libgnunettransport.la \ | 70 | libgnunettransport.la \ |
71 | libgnunettransporttesting.la | 71 | libgnunettransporttesting.la |
72 | 72 | ||
73 | libgnunettransporttesting_la_SOURCES = \ | 73 | libgnunettransporttesting_la_SOURCES = \ |
74 | transport-testing.c | 74 | transport-testing.c |
75 | libgnunettransporttesting_la_LIBADD = \ | 75 | libgnunettransporttesting_la_LIBADD = \ |
@@ -355,7 +355,6 @@ test_transport_api_disconnect_LDADD = \ | |||
355 | $(top_builddir)/src/transport/libgnunettransport.la \ | 355 | $(top_builddir)/src/transport/libgnunettransport.la \ |
356 | $(top_builddir)/src/hello/libgnunethello.la \ | 356 | $(top_builddir)/src/hello/libgnunethello.la \ |
357 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 357 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
358 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
359 | $(top_builddir)/src/util/libgnunetutil.la | 358 | $(top_builddir)/src/util/libgnunetutil.la |
360 | 359 | ||
361 | test_transport_startonly_SOURCES = \ | 360 | test_transport_startonly_SOURCES = \ |
@@ -364,7 +363,6 @@ test_transport_startonly_LDADD = \ | |||
364 | $(top_builddir)/src/transport/libgnunettransport.la \ | 363 | $(top_builddir)/src/transport/libgnunettransport.la \ |
365 | $(top_builddir)/src/hello/libgnunethello.la \ | 364 | $(top_builddir)/src/hello/libgnunethello.la \ |
366 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 365 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
367 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
368 | $(top_builddir)/src/util/libgnunetutil.la \ | 366 | $(top_builddir)/src/util/libgnunetutil.la \ |
369 | $(top_builddir)/src/transport/libgnunettransporttesting.la | 367 | $(top_builddir)/src/transport/libgnunettransporttesting.la |
370 | 368 | ||
@@ -374,7 +372,6 @@ test_transport_ats_LDADD = -lm \ | |||
374 | -lglpk \ | 372 | -lglpk \ |
375 | $(top_builddir)/src/transport/libgnunettransport.la \ | 373 | $(top_builddir)/src/transport/libgnunettransport.la \ |
376 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 374 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
377 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
378 | $(top_builddir)/src/util/libgnunetutil.la | 375 | $(top_builddir)/src/util/libgnunetutil.la |
379 | 376 | ||
380 | test_transport_ats_multiple_peers_SOURCES = \ | 377 | test_transport_ats_multiple_peers_SOURCES = \ |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 5bf3c4c77..74ff1749c 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -1616,7 +1616,8 @@ transmit_send_continuation (void *cls, const struct GNUNET_PeerIdentity *target, | |||
1616 | if (n == NULL) | 1616 | if (n == NULL) |
1617 | { | 1617 | { |
1618 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "transmit_send_continuation", | 1618 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "transmit_send_continuation", |
1619 | "Neighbour `%s' no longer exists\n", GNUNET_i2s (&mq->neighbour_id)); | 1619 | "Neighbour `%s' no longer exists\n", |
1620 | GNUNET_i2s (&mq->neighbour_id)); | ||
1620 | return; | 1621 | return; |
1621 | } | 1622 | } |
1622 | if (mq->client != NULL) | 1623 | if (mq->client != NULL) |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index a79803afc..654bf52b8 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -218,7 +218,7 @@ struct ValidationEntry | |||
218 | size_t addrlen; | 218 | size_t addrlen; |
219 | 219 | ||
220 | /** | 220 | /** |
221 | * When passing the address in 'add_valid_peer_address', did we | 221 | * When passing the address in 'add_valid_peer_address', did we |
222 | * copy the address to the HELLO yet? | 222 | * copy the address to the HELLO yet? |
223 | */ | 223 | */ |
224 | int copied; | 224 | int copied; |
@@ -880,7 +880,7 @@ add_valid_peer_address (void *cls, size_t max, void *buf) | |||
880 | struct ValidationEntry *ve = cls; | 880 | struct ValidationEntry *ve = cls; |
881 | 881 | ||
882 | if (GNUNET_YES == ve->copied) | 882 | if (GNUNET_YES == ve->copied) |
883 | return 0; /* terminate */ | 883 | return 0; /* terminate */ |
884 | ve->copied = GNUNET_YES; | 884 | ve->copied = GNUNET_YES; |
885 | return GNUNET_HELLO_add_address (ve->transport_name, ve->valid_until, | 885 | return GNUNET_HELLO_add_address (ve->transport_name, ve->valid_until, |
886 | ve->addr, ve->addrlen, buf, max); | 886 | ve->addr, ve->addrlen, buf, max); |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 71332bf36..63bd7da02 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -601,8 +601,8 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
601 | GNUNET_SCHEDULER_cancel (tct); | 601 | GNUNET_SCHEDULER_cancel (tct); |
602 | tct = GNUNET_SCHEDULER_NO_TASK; | 602 | tct = GNUNET_SCHEDULER_NO_TASK; |
603 | } | 603 | } |
604 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); | 604 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
605 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); | 605 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
606 | if (is_asymmetric_send_constant == GNUNET_YES) | 606 | if (is_asymmetric_send_constant == GNUNET_YES) |
607 | measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MAX_QUOTA); | 607 | measure (MEASUREMENT_MIN_QUOTA, MEASUREMENT_MAX_QUOTA); |
608 | else if (is_asymmetric_recv_constant == GNUNET_YES) | 608 | else if (is_asymmetric_recv_constant == GNUNET_YES) |
@@ -776,8 +776,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
776 | 776 | ||
777 | GNUNET_assert (p1.th != NULL); | 777 | GNUNET_assert (p1.th != NULL); |
778 | GNUNET_assert (p2.th != NULL); | 778 | GNUNET_assert (p2.th != NULL); |
779 | GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); | 779 | p1.ghh = GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); |
780 | GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); | 780 | p2.ghh = GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); |
781 | tct = GNUNET_SCHEDULER_add_now (&try_connect, NULL); | 781 | tct = GNUNET_SCHEDULER_add_now (&try_connect, NULL); |
782 | } | 782 | } |
783 | 783 | ||
diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c index 540d3b729..a96a1a152 100644 --- a/src/transport/test_transport_api_disconnect.c +++ b/src/transport/test_transport_api_disconnect.c | |||
@@ -170,8 +170,8 @@ end_badly () | |||
170 | } | 170 | } |
171 | else | 171 | else |
172 | { | 172 | { |
173 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); | 173 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
174 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); | 174 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
175 | } | 175 | } |
176 | 176 | ||
177 | GNUNET_TRANSPORT_disconnect (p1.th); | 177 | GNUNET_TRANSPORT_disconnect (p1.th); |
@@ -314,8 +314,8 @@ peers_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
314 | 314 | ||
315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from Transport \n"); | 315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from Transport \n"); |
316 | 316 | ||
317 | GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, &p2); | 317 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
318 | GNUNET_TRANSPORT_get_hello_cancel (p1.th, &exchange_hello, &p1); | 318 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
319 | 319 | ||
320 | GNUNET_TRANSPORT_disconnect (p1.th); | 320 | GNUNET_TRANSPORT_disconnect (p1.th); |
321 | p1.th = NULL; | 321 | p1.th = NULL; |
@@ -358,8 +358,8 @@ peers_connect () | |||
358 | GNUNET_assert (p1.th != NULL); | 358 | GNUNET_assert (p1.th != NULL); |
359 | GNUNET_assert (p2.th != NULL); | 359 | GNUNET_assert (p2.th != NULL); |
360 | 360 | ||
361 | GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); | 361 | p1.ghh = GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); |
362 | GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); | 362 | p2.ghh = GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); |
363 | tct = GNUNET_SCHEDULER_add_now (&try_connect, NULL); | 363 | tct = GNUNET_SCHEDULER_add_now (&try_connect, NULL); |
364 | } | 364 | } |
365 | 365 | ||
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 02bab07f4..e604c5961 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -34,7 +34,6 @@ struct ConnectingContext | |||
34 | GNUNET_SCHEDULER_TaskIdentifier tct; | 34 | GNUNET_SCHEDULER_TaskIdentifier tct; |
35 | GNUNET_TRANSPORT_TESTING_connect_cb cb; | 35 | GNUNET_TRANSPORT_TESTING_connect_cb cb; |
36 | void *cb_cls; | 36 | void *cb_cls; |
37 | |||
38 | struct GNUNET_TRANSPORT_Handle *th_p1; | 37 | struct GNUNET_TRANSPORT_Handle *th_p1; |
39 | struct GNUNET_TRANSPORT_Handle *th_p2; | 38 | struct GNUNET_TRANSPORT_Handle *th_p2; |
40 | int p1_c; | 39 | int p1_c; |
@@ -73,8 +72,8 @@ notify_connect_internal (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
73 | if ((cc->p2_c == GNUNET_YES) && (cc->p2_c == GNUNET_YES)) | 72 | if ((cc->p2_c == GNUNET_YES) && (cc->p2_c == GNUNET_YES)) |
74 | { | 73 | { |
75 | /* clean up */ | 74 | /* clean up */ |
76 | GNUNET_TRANSPORT_get_hello_cancel (cc->th_p2, &exchange_hello_last, cc); | 75 | GNUNET_TRANSPORT_get_hello_cancel (cc->p1->ghh); |
77 | GNUNET_TRANSPORT_get_hello_cancel (cc->th_p1, &exchange_hello, cc); | 76 | GNUNET_TRANSPORT_get_hello_cancel (cc->p2->ghh); |
78 | 77 | ||
79 | if (cc->tct != GNUNET_SCHEDULER_NO_TASK) | 78 | if (cc->tct != GNUNET_SCHEDULER_NO_TASK) |
80 | GNUNET_SCHEDULER_cancel (cc->tct); | 79 | GNUNET_SCHEDULER_cancel (cc->tct); |
@@ -315,8 +314,8 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct PeerContext *p1, | |||
315 | GNUNET_assert (cc->th_p1 != NULL); | 314 | GNUNET_assert (cc->th_p1 != NULL); |
316 | GNUNET_assert (cc->th_p2 != NULL); | 315 | GNUNET_assert (cc->th_p2 != NULL); |
317 | 316 | ||
318 | GNUNET_TRANSPORT_get_hello (cc->th_p1, &exchange_hello, cc); | 317 | p1->ghh = GNUNET_TRANSPORT_get_hello (cc->th_p1, &exchange_hello, cc); |
319 | GNUNET_TRANSPORT_get_hello (cc->th_p2, &exchange_hello_last, cc); | 318 | p2->ghh = GNUNET_TRANSPORT_get_hello (cc->th_p2, &exchange_hello_last, cc); |
320 | 319 | ||
321 | cc->tct = GNUNET_SCHEDULER_add_now (&try_connect, cc); | 320 | cc->tct = GNUNET_SCHEDULER_add_now (&try_connect, cc); |
322 | return cc; | 321 | return cc; |
@@ -333,8 +332,8 @@ void GNUNET_TRANSPORT_TESTING_connect_peers_cancel | |||
333 | struct ConnectingContext *cc = ccr; | 332 | struct ConnectingContext *cc = ccr; |
334 | 333 | ||
335 | /* clean up */ | 334 | /* clean up */ |
336 | GNUNET_TRANSPORT_get_hello_cancel (cc->th_p2, &exchange_hello_last, cc); | 335 | GNUNET_TRANSPORT_get_hello_cancel (cc->p1->ghh); |
337 | GNUNET_TRANSPORT_get_hello_cancel (cc->th_p1, &exchange_hello, cc); | 336 | GNUNET_TRANSPORT_get_hello_cancel (cc->p2->ghh); |
338 | 337 | ||
339 | if (cc->tct != GNUNET_SCHEDULER_NO_TASK) | 338 | if (cc->tct != GNUNET_SCHEDULER_NO_TASK) |
340 | GNUNET_SCHEDULER_cancel (cc->tct); | 339 | GNUNET_SCHEDULER_cancel (cc->tct); |
diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h index 852f060e4..80eae3630 100644 --- a/src/transport/transport-testing.h +++ b/src/transport/transport-testing.h | |||
@@ -44,6 +44,8 @@ struct PeerContext | |||
44 | 44 | ||
45 | struct GNUNET_TRANSPORT_Handle *th; | 45 | struct GNUNET_TRANSPORT_Handle *th; |
46 | 46 | ||
47 | struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | ||
48 | |||
47 | struct GNUNET_PeerIdentity id; | 49 | struct GNUNET_PeerIdentity id; |
48 | 50 | ||
49 | struct GNUNET_OS_Process *arm_proc; | 51 | struct GNUNET_OS_Process *arm_proc; |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index a6d2fa0ba..bbfe1e63d 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -150,18 +150,23 @@ struct Neighbour | |||
150 | /** | 150 | /** |
151 | * Linked list of functions to call whenever our HELLO is updated. | 151 | * Linked list of functions to call whenever our HELLO is updated. |
152 | */ | 152 | */ |
153 | struct HelloWaitList | 153 | struct GNUNET_TRANSPORT_GetHelloHandle |
154 | { | 154 | { |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * This is a doubly linked list. | 157 | * This is a doubly linked list. |
158 | */ | 158 | */ |
159 | struct HelloWaitList *next; | 159 | struct GNUNET_TRANSPORT_GetHelloHandle *next; |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * This is a doubly linked list. | 162 | * This is a doubly linked list. |
163 | */ | 163 | */ |
164 | struct HelloWaitList *prev; | 164 | struct GNUNET_TRANSPORT_GetHelloHandle *prev; |
165 | |||
166 | /** | ||
167 | * Transport handle. | ||
168 | */ | ||
169 | struct GNUNET_TRANSPORT_Handle *handle; | ||
165 | 170 | ||
166 | /** | 171 | /** |
167 | * Callback to call once we got our HELLO. | 172 | * Callback to call once we got our HELLO. |
@@ -232,12 +237,12 @@ struct GNUNET_TRANSPORT_Handle | |||
232 | /** | 237 | /** |
233 | * Linked list of pending requests for our HELLO. | 238 | * Linked list of pending requests for our HELLO. |
234 | */ | 239 | */ |
235 | struct HelloWaitList *hwl_head; | 240 | struct GNUNET_TRANSPORT_GetHelloHandle *hwl_head; |
236 | 241 | ||
237 | /** | 242 | /** |
238 | * Linked list of pending requests for our HELLO. | 243 | * Linked list of pending requests for our HELLO. |
239 | */ | 244 | */ |
240 | struct HelloWaitList *hwl_tail; | 245 | struct GNUNET_TRANSPORT_GetHelloHandle *hwl_tail; |
241 | 246 | ||
242 | /** | 247 | /** |
243 | * My configuration. | 248 | * My configuration. |
@@ -397,8 +402,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
397 | const struct InboundMessage *im; | 402 | const struct InboundMessage *im; |
398 | const struct GNUNET_MessageHeader *imm; | 403 | const struct GNUNET_MessageHeader *imm; |
399 | const struct SendOkMessage *okm; | 404 | const struct SendOkMessage *okm; |
400 | struct HelloWaitList *hwl; | 405 | struct GNUNET_TRANSPORT_GetHelloHandle *hwl; |
401 | struct HelloWaitList *next_hwl; | 406 | struct GNUNET_TRANSPORT_GetHelloHandle *next_hwl; |
402 | struct Neighbour *n; | 407 | struct Neighbour *n; |
403 | struct GNUNET_PeerIdentity me; | 408 | struct GNUNET_PeerIdentity me; |
404 | uint16_t size; | 409 | uint16_t size; |
@@ -1189,50 +1194,39 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
1189 | * (handshake with transport service pending/failed). | 1194 | * (handshake with transport service pending/failed). |
1190 | * cost estimate will be 0. | 1195 | * cost estimate will be 0. |
1191 | * @param rec_cls closure for rec | 1196 | * @param rec_cls closure for rec |
1197 | * @return handle to cancel the operation, NULL on error | ||
1192 | */ | 1198 | */ |
1193 | void | 1199 | struct GNUNET_TRANSPORT_GetHelloHandle * |
1194 | GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, | 1200 | GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, |
1195 | GNUNET_TRANSPORT_HelloUpdateCallback rec, | 1201 | GNUNET_TRANSPORT_HelloUpdateCallback rec, |
1196 | void *rec_cls) | 1202 | void *rec_cls) |
1197 | { | 1203 | { |
1198 | struct HelloWaitList *hwl; | 1204 | struct GNUNET_TRANSPORT_GetHelloHandle *hwl; |
1199 | 1205 | ||
1200 | hwl = GNUNET_malloc (sizeof (struct HelloWaitList)); | 1206 | if (handle->my_hello == NULL) |
1207 | return NULL; | ||
1208 | hwl = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_GetHelloHandle)); | ||
1201 | hwl->rec = rec; | 1209 | hwl->rec = rec; |
1202 | hwl->rec_cls = rec_cls; | 1210 | hwl->rec_cls = rec_cls; |
1211 | hwl->handle = handle; | ||
1203 | GNUNET_CONTAINER_DLL_insert (handle->hwl_head, handle->hwl_tail, hwl); | 1212 | GNUNET_CONTAINER_DLL_insert (handle->hwl_head, handle->hwl_tail, hwl); |
1204 | if (handle->my_hello == NULL) | ||
1205 | return; | ||
1206 | rec (rec_cls, (const struct GNUNET_MessageHeader *) handle->my_hello); | 1213 | rec (rec_cls, (const struct GNUNET_MessageHeader *) handle->my_hello); |
1214 | return hwl; | ||
1207 | } | 1215 | } |
1208 | 1216 | ||
1209 | 1217 | ||
1210 | /** | 1218 | /** |
1211 | * Stop receiving updates about changes to our HELLO message. | 1219 | * Stop receiving updates about changes to our HELLO message. |
1212 | * | 1220 | * |
1213 | * @param handle connection to transport service | 1221 | * @param ghh handle to cancel |
1214 | * @param rec function previously registered to be called with the HELLOs | ||
1215 | * @param rec_cls closure for rec | ||
1216 | */ | 1222 | */ |
1217 | void | 1223 | void |
1218 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_Handle *handle, | 1224 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh) |
1219 | GNUNET_TRANSPORT_HelloUpdateCallback rec, | ||
1220 | void *rec_cls) | ||
1221 | { | 1225 | { |
1222 | struct HelloWaitList *pos; | 1226 | struct GNUNET_TRANSPORT_Handle *handle = ghh->handle; |
1223 | 1227 | ||
1224 | pos = handle->hwl_head; | 1228 | GNUNET_CONTAINER_DLL_remove (handle->hwl_head, handle->hwl_tail, ghh); |
1225 | while (pos != NULL) | 1229 | GNUNET_free (ghh); |
1226 | { | ||
1227 | if ((pos->rec == rec) && (pos->rec_cls == rec_cls)) | ||
1228 | break; | ||
1229 | pos = pos->next; | ||
1230 | } | ||
1231 | GNUNET_break (pos != NULL); | ||
1232 | if (pos == NULL) | ||
1233 | return; | ||
1234 | GNUNET_CONTAINER_DLL_remove (handle->hwl_head, handle->hwl_tail, pos); | ||
1235 | GNUNET_free (pos); | ||
1236 | } | 1230 | } |
1237 | 1231 | ||
1238 | 1232 | ||