diff options
Diffstat (limited to 'src/transport/test_transport_api_restart_2peers.c')
-rw-r--r-- | src/transport/test_transport_api_restart_2peers.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c index 18cc87c78..876b7209c 100644 --- a/src/transport/test_transport_api_restart_2peers.c +++ b/src/transport/test_transport_api_restart_2peers.c | |||
@@ -50,15 +50,15 @@ static struct GNUNET_SCHEDULER_Task *send_task; | |||
50 | 50 | ||
51 | static struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; | 51 | static struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh; |
52 | 52 | ||
53 | static struct PeerContext *p1; | 53 | static struct GNUNET_TRANSPORT_TESTING_PeerContext *p1; |
54 | 54 | ||
55 | static struct PeerContext *p2; | 55 | static struct GNUNET_TRANSPORT_TESTING_PeerContext *p2; |
56 | 56 | ||
57 | static struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc; | 57 | static struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc; |
58 | 58 | ||
59 | static struct GNUNET_TRANSPORT_TransmitHandle *th; | 59 | static struct GNUNET_TRANSPORT_TransmitHandle *th; |
60 | 60 | ||
61 | static struct GNUNET_TRANSPORT_TESTING_handle *tth; | 61 | static struct GNUNET_TRANSPORT_TESTING_Handle *tth; |
62 | 62 | ||
63 | static char *cfg_file_p1; | 63 | static char *cfg_file_p1; |
64 | 64 | ||
@@ -93,12 +93,12 @@ end () | |||
93 | } | 93 | } |
94 | if (NULL != p1) | 94 | if (NULL != p1) |
95 | { | 95 | { |
96 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); | 96 | GNUNET_TRANSPORT_TESTING_stop_peer (p1); |
97 | p1 = NULL; | 97 | p1 = NULL; |
98 | } | 98 | } |
99 | if (NULL != p2) | 99 | if (NULL != p2) |
100 | { | 100 | { |
101 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); | 101 | GNUNET_TRANSPORT_TESTING_stop_peer (p2); |
102 | p2 = NULL; | 102 | p2 = NULL; |
103 | } | 103 | } |
104 | } | 104 | } |
@@ -120,7 +120,7 @@ end_badly (void *cls) | |||
120 | { | 120 | { |
121 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 121 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
122 | _("Fail! Could not connect peers\n")); | 122 | _("Fail! Could not connect peers\n")); |
123 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); | 123 | GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc); |
124 | cc = NULL; | 124 | cc = NULL; |
125 | } | 125 | } |
126 | end (); | 126 | end (); |
@@ -129,7 +129,7 @@ end_badly (void *cls) | |||
129 | 129 | ||
130 | 130 | ||
131 | static void | 131 | static void |
132 | restart_cb (struct PeerContext *p, | 132 | restart_cb (struct GNUNET_TRANSPORT_TESTING_PeerContext *p, |
133 | void *cls) | 133 | void *cls) |
134 | { | 134 | { |
135 | static int c; | 135 | static int c; |
@@ -148,8 +148,7 @@ restart_cb (struct PeerContext *p, | |||
148 | 148 | ||
149 | 149 | ||
150 | static void | 150 | static void |
151 | restart (struct PeerContext *p, | 151 | restart (struct GNUNET_TRANSPORT_TESTING_PeerContext *p) |
152 | const char *cfg_file) | ||
153 | { | 152 | { |
154 | GNUNET_assert (NULL != p); | 153 | GNUNET_assert (NULL != p); |
155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -157,7 +156,6 @@ restart (struct PeerContext *p, | |||
157 | p->no, | 156 | p->no, |
158 | GNUNET_i2s (&p->id)); | 157 | GNUNET_i2s (&p->id)); |
159 | GNUNET_TRANSPORT_TESTING_restart_peer (p, | 158 | GNUNET_TRANSPORT_TESTING_restart_peer (p, |
160 | cfg_file, | ||
161 | &restart_cb, | 159 | &restart_cb, |
162 | p); | 160 | p); |
163 | } | 161 | } |
@@ -168,8 +166,8 @@ notify_receive (void *cls, | |||
168 | const struct GNUNET_PeerIdentity *peer, | 166 | const struct GNUNET_PeerIdentity *peer, |
169 | const struct GNUNET_MessageHeader *message) | 167 | const struct GNUNET_MessageHeader *message) |
170 | { | 168 | { |
171 | struct PeerContext *p = cls; | 169 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls; |
172 | struct PeerContext *t = NULL; | 170 | struct GNUNET_TRANSPORT_TESTING_PeerContext *t = NULL; |
173 | 171 | ||
174 | if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity))) | 172 | if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity))) |
175 | t = p1; | 173 | t = p1; |
@@ -197,8 +195,8 @@ notify_receive (void *cls, | |||
197 | if (restarted == GNUNET_NO) | 195 | if (restarted == GNUNET_NO) |
198 | { | 196 | { |
199 | restarted = GNUNET_YES; | 197 | restarted = GNUNET_YES; |
200 | restart (p1, cfg_file_p1); | 198 | restart (p1); |
201 | restart (p2, cfg_file_p2); | 199 | restart (p2); |
202 | return; | 200 | return; |
203 | } | 201 | } |
204 | else | 202 | else |
@@ -225,7 +223,7 @@ notify_ready (void *cls, | |||
225 | size_t size, | 223 | size_t size, |
226 | void *buf) | 224 | void *buf) |
227 | { | 225 | { |
228 | struct PeerContext *p = cls; | 226 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls; |
229 | struct GNUNET_MessageHeader *hdr; | 227 | struct GNUNET_MessageHeader *hdr; |
230 | 228 | ||
231 | th = NULL; | 229 | th = NULL; |
@@ -292,8 +290,8 @@ static void | |||
292 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | 290 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) |
293 | { | 291 | { |
294 | static int c; | 292 | static int c; |
295 | struct PeerContext *p = cls; | 293 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls; |
296 | struct PeerContext *t = NULL; | 294 | struct GNUNET_TRANSPORT_TESTING_PeerContext *t = NULL; |
297 | 295 | ||
298 | c++; | 296 | c++; |
299 | if (0 == memcmp (peer, | 297 | if (0 == memcmp (peer, |
@@ -330,7 +328,7 @@ static void | |||
330 | notify_disconnect (void *cls, | 328 | notify_disconnect (void *cls, |
331 | const struct GNUNET_PeerIdentity *peer) | 329 | const struct GNUNET_PeerIdentity *peer) |
332 | { | 330 | { |
333 | struct PeerContext *p = cls; | 331 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls; |
334 | 332 | ||
335 | { | 333 | { |
336 | char *ps = GNUNET_strdup (GNUNET_i2s (&p->id)); | 334 | char *ps = GNUNET_strdup (GNUNET_i2s (&p->id)); |
@@ -357,9 +355,7 @@ notify_disconnect (void *cls, | |||
357 | 355 | ||
358 | 356 | ||
359 | static void | 357 | static void |
360 | testing_connect_cb (struct PeerContext *p1, | 358 | testing_connect_cb (void *cls) |
361 | struct PeerContext *p2, | ||
362 | void *cls) | ||
363 | { | 359 | { |
364 | cc = NULL; | 360 | cc = NULL; |
365 | 361 | ||
@@ -380,7 +376,7 @@ testing_connect_cb (struct PeerContext *p1, | |||
380 | 376 | ||
381 | 377 | ||
382 | static void | 378 | static void |
383 | start_cb (struct PeerContext *p, void *cls) | 379 | start_cb (struct GNUNET_TRANSPORT_TESTING_PeerContext *p, void *cls) |
384 | { | 380 | { |
385 | static int started; | 381 | static int started; |
386 | 382 | ||
@@ -404,8 +400,7 @@ start_cb (struct PeerContext *p, void *cls) | |||
404 | GNUNET_free (sender_c); | 400 | GNUNET_free (sender_c); |
405 | } | 401 | } |
406 | 402 | ||
407 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, | 403 | cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, |
408 | p1, | ||
409 | p2, | 404 | p2, |
410 | &testing_connect_cb, | 405 | &testing_connect_cb, |
411 | NULL); | 406 | NULL); |
@@ -477,7 +472,7 @@ main (int argc, char *argv[]) | |||
477 | { | 472 | { |
478 | int ret; | 473 | int ret; |
479 | 474 | ||
480 | GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); | 475 | test_name = GNUNET_TRANSPORT_TESTING_get_test_name (argv[0]); |
481 | GNUNET_log_setup (test_name, | 476 | GNUNET_log_setup (test_name, |
482 | "WARNING", | 477 | "WARNING", |
483 | NULL); | 478 | NULL); |