aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-02 11:21:00 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-02 11:21:00 +0000
commit147d72a99e4ed0558c98fe7c9c41062ede51a68a (patch)
treef712c8aa222e53dc3e299972f3144ad92b15b180 /src/testing
parent8439fe12f24ab3ae5a1821face2b79d443fa044e (diff)
downloadgnunet-147d72a99e4ed0558c98fe7c9c41062ede51a68a.tar.gz
gnunet-147d72a99e4ed0558c98fe7c9c41062ede51a68a.zip
cleanup API for get_hello and get_hello_cancel
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.c35
1 files changed, 22 insertions, 13 deletions
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 (&notify_daemon_started, d); 710 GNUNET_SCHEDULER_add_now (&notify_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)