diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-01-19 14:20:54 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-01-19 14:20:54 +0000 |
commit | b6dbf7e98bb79907562bf67d423b67a030b503e7 (patch) | |
tree | 4a63aa64d332add505dd167289630c4c5a385233 /src/transport/test_transport_api.c | |
parent | fff6dc1db59348e426b4c6cc5a5729080d93a163 (diff) | |
download | gnunet-b6dbf7e98bb79907562bf67d423b67a030b503e7.tar.gz gnunet-b6dbf7e98bb79907562bf67d423b67a030b503e7.zip |
pre-commit
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r-- | src/transport/test_transport_api.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 90e12d75b..a5afc5fe4 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -120,10 +120,8 @@ notify_connect (void *cls, | |||
120 | const struct GNUNET_PeerIdentity *peer, | 120 | const struct GNUNET_PeerIdentity *peer, |
121 | struct GNUNET_TIME_Relative latency) | 121 | struct GNUNET_TIME_Relative latency) |
122 | { | 122 | { |
123 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 123 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
124 | "Peer `%4s' connected to us (%p)!\n", | 124 | "Peer `%4s' connected to us (%p)!\n", GNUNET_i2s (peer), cls); |
125 | GNUNET_i2s(peer), | ||
126 | cls); | ||
127 | GNUNET_assert ((ok >= 1) && (ok <= 6)); | 125 | GNUNET_assert ((ok >= 1) && (ok <= 6)); |
128 | OKPP; | 126 | OKPP; |
129 | } | 127 | } |
@@ -197,14 +195,15 @@ exchange_hello_last (void *cls, | |||
197 | GNUNET_assert (message != NULL); | 195 | GNUNET_assert (message != NULL); |
198 | GNUNET_assert (GNUNET_OK == | 196 | GNUNET_assert (GNUNET_OK == |
199 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | 197 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) |
200 | message, &me->id)); | 198 | message, &me->id)); |
201 | GNUNET_TRANSPORT_offer_hello (p1.th, message); | 199 | GNUNET_TRANSPORT_offer_hello (p1.th, message); |
202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
203 | "Finished exchanging HELLOs, now waiting for transmission!\n"); | 201 | "Finished exchanging HELLOs, now waiting for transmission!\n"); |
204 | /* both HELLOs exchanged, get ready to test transmission! */ | 202 | /* both HELLOs exchanged, get ready to test transmission! */ |
205 | GNUNET_TRANSPORT_notify_transmit_ready (p1.th, | 203 | GNUNET_TRANSPORT_notify_transmit_ready (p1.th, |
206 | &p2.id, | 204 | &p2.id, |
207 | 256, 0, TIMEOUT, ¬ify_ready, &p1); | 205 | 256, 0, TIMEOUT, ¬ify_ready, |
206 | &p1); | ||
208 | } | 207 | } |
209 | 208 | ||
210 | 209 | ||
@@ -223,10 +222,8 @@ exchange_hello (void *cls, | |||
223 | GNUNET_assert (message != NULL); | 222 | GNUNET_assert (message != NULL); |
224 | GNUNET_assert (GNUNET_OK == | 223 | GNUNET_assert (GNUNET_OK == |
225 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) | 224 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) |
226 | message, &me->id)); | 225 | message, &me->id)); |
227 | GNUNET_TRANSPORT_get_hello (p2.th, | 226 | GNUNET_TRANSPORT_get_hello (p2.th, TIMEOUT, &exchange_hello_last, &p2); |
228 | TIMEOUT, | ||
229 | &exchange_hello_last, &p2); | ||
230 | } | 227 | } |
231 | 228 | ||
232 | 229 | ||
@@ -234,16 +231,14 @@ static void | |||
234 | run (void *cls, | 231 | run (void *cls, |
235 | struct GNUNET_SCHEDULER_Handle *s, | 232 | struct GNUNET_SCHEDULER_Handle *s, |
236 | char *const *args, | 233 | char *const *args, |
237 | const char *cfgfile, | 234 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
238 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
239 | { | 235 | { |
240 | GNUNET_assert (ok == 1); | 236 | GNUNET_assert (ok == 1); |
241 | OKPP; | 237 | OKPP; |
242 | sched = s; | 238 | sched = s; |
243 | setup_peer (&p1, "test_transport_api_peer1.conf"); | 239 | setup_peer (&p1, "test_transport_api_peer1.conf"); |
244 | setup_peer (&p2, "test_transport_api_peer2.conf"); | 240 | setup_peer (&p2, "test_transport_api_peer2.conf"); |
245 | GNUNET_TRANSPORT_get_hello (p1.th, | 241 | GNUNET_TRANSPORT_get_hello (p1.th, TIMEOUT, &exchange_hello, &p1); |
246 | TIMEOUT, &exchange_hello, &p1); | ||
247 | } | 242 | } |
248 | 243 | ||
249 | 244 | ||
@@ -253,7 +248,7 @@ stop_arm (struct PeerContext *p) | |||
253 | #if START_ARM | 248 | #if START_ARM |
254 | if (0 != PLIBC_KILL (p->arm_pid, SIGTERM)) | 249 | if (0 != PLIBC_KILL (p->arm_pid, SIGTERM)) |
255 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 250 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
256 | GNUNET_OS_process_wait(p->arm_pid); | 251 | GNUNET_OS_process_wait (p->arm_pid); |
257 | #endif | 252 | #endif |
258 | GNUNET_CONFIGURATION_destroy (p->cfg); | 253 | GNUNET_CONFIGURATION_destroy (p->cfg); |
259 | } | 254 | } |
@@ -296,7 +291,7 @@ main (int argc, char *argv[]) | |||
296 | #endif | 291 | #endif |
297 | NULL); | 292 | NULL); |
298 | ret = check (); | 293 | ret = check (); |
299 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); | 294 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); |
300 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); | 295 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); |
301 | return ret; | 296 | return ret; |
302 | } | 297 | } |