diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-17 11:12:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-17 11:12:21 +0000 |
commit | 8c89248aa6ab5db7d0f88d95bfc151635d3f8b52 (patch) | |
tree | 8e96b8687781493850b070d22bf06873b6d41a2a /src/core/test_core_quota_compliance.c | |
parent | 469571975ea9114c835789caf3f4951984374000 (diff) | |
download | gnunet-8c89248aa6ab5db7d0f88d95bfc151635d3f8b52.tar.gz gnunet-8c89248aa6ab5db7d0f88d95bfc151635d3f8b52.zip |
try to connect more than just once
Diffstat (limited to 'src/core/test_core_quota_compliance.c')
-rw-r--r-- | src/core/test_core_quota_compliance.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 3f619f49a..c543f09cd 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -72,6 +72,8 @@ static GNUNET_SCHEDULER_TaskIdentifier err_task; | |||
72 | 72 | ||
73 | static GNUNET_SCHEDULER_TaskIdentifier measure_task; | 73 | static GNUNET_SCHEDULER_TaskIdentifier measure_task; |
74 | 74 | ||
75 | static GNUNET_SCHEDULER_TaskIdentifier connect_task; | ||
76 | |||
75 | 77 | ||
76 | struct PeerContext | 78 | struct PeerContext |
77 | { | 79 | { |
@@ -132,6 +134,8 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
132 | GNUNET_CORE_notify_transmit_ready_cancel (p1.nth); | 134 | GNUNET_CORE_notify_transmit_ready_cancel (p1.nth); |
133 | p1.nth = NULL; | 135 | p1.nth = NULL; |
134 | } | 136 | } |
137 | if (connect_task != GNUNET_SCHEDULER_NO_TASK) | ||
138 | GNUNET_SCHEDULER_cancel (connect_task); | ||
135 | ch = p1.ch; | 139 | ch = p1.ch; |
136 | p1.ch = NULL; | 140 | p1.ch = NULL; |
137 | GNUNET_CORE_disconnect (ch); | 141 | GNUNET_CORE_disconnect (ch); |
@@ -160,6 +164,8 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
160 | } | 164 | } |
161 | if (measure_task != GNUNET_SCHEDULER_NO_TASK) | 165 | if (measure_task != GNUNET_SCHEDULER_NO_TASK) |
162 | GNUNET_SCHEDULER_cancel (measure_task); | 166 | GNUNET_SCHEDULER_cancel (measure_task); |
167 | if (connect_task != GNUNET_SCHEDULER_NO_TASK) | ||
168 | GNUNET_SCHEDULER_cancel (connect_task); | ||
163 | 169 | ||
164 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); | 170 | GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); |
165 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); | 171 | GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); |
@@ -176,6 +182,15 @@ terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
176 | } | 182 | } |
177 | 183 | ||
178 | 184 | ||
185 | static void | ||
186 | try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
187 | { | ||
188 | connect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
189 | &try_connect, NULL); | ||
190 | GNUNET_TRANSPORT_try_connect (p1.th, &p2.id); | ||
191 | GNUNET_TRANSPORT_try_connect (p2.th, &p1.id); | ||
192 | } | ||
193 | |||
179 | /** | 194 | /** |
180 | * Callback function to process statistic values. | 195 | * Callback function to process statistic values. |
181 | * | 196 | * |
@@ -533,8 +548,8 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server, | |||
533 | "Asking core (1) to connect to peer `%4s'\n", | 548 | "Asking core (1) to connect to peer `%4s'\n", |
534 | GNUNET_i2s (&p2.id)); | 549 | GNUNET_i2s (&p2.id)); |
535 | #endif | 550 | #endif |
536 | GNUNET_TRANSPORT_try_connect (p1.th, &p2.id); | 551 | connect_task = GNUNET_SCHEDULER_add_now (&try_connect, |
537 | GNUNET_TRANSPORT_try_connect (p2.th, &p1.id); | 552 | NULL); |
538 | } | 553 | } |
539 | } | 554 | } |
540 | 555 | ||