diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-12 07:03:34 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-08-12 07:03:34 +0000 |
commit | b19fa751b866bb6855ed92beb2bee30917f868c8 (patch) | |
tree | 76f0433e011d834a672d10d285369b9b7f1fb17e /src/transport/transport-testing.c | |
parent | 5434646c91cc203f4113018503b06ada292060d4 (diff) | |
download | gnunet-b19fa751b866bb6855ed92beb2bee30917f868c8.tar.gz gnunet-b19fa751b866bb6855ed92beb2bee30917f868c8.zip |
test_transport_api ported to use new testing lib
Diffstat (limited to 'src/transport/transport-testing.c')
-rw-r--r-- | src/transport/transport-testing.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 16e7a1e25..fab0fec5a 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -37,7 +37,8 @@ struct ConnectingContext | |||
37 | 37 | ||
38 | struct GNUNET_TRANSPORT_Handle *th_p1; | 38 | struct GNUNET_TRANSPORT_Handle *th_p1; |
39 | struct GNUNET_TRANSPORT_Handle *th_p2; | 39 | struct GNUNET_TRANSPORT_Handle *th_p2; |
40 | int c; | 40 | int p1_c; |
41 | int p2_c; | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | static void | 44 | static void |
@@ -54,12 +55,21 @@ notify_connect_internal (void *cls, | |||
54 | uint32_t ats_count) | 55 | uint32_t ats_count) |
55 | { | 56 | { |
56 | struct ConnectingContext * cc = cls; | 57 | struct ConnectingContext * cc = cls; |
57 | // /void * cb_cls = cc->cb_cls; | ||
58 | 58 | ||
59 | GNUNET_assert(cc != NULL); | 59 | GNUNET_assert(cc != NULL); |
60 | cc->c++; | ||
61 | 60 | ||
62 | if (cc->c == 2) | 61 | if (0 == memcmp (&(*peer).hashPubKey, &cc->p1->id.hashPubKey, sizeof (GNUNET_HashCode))) |
62 | { | ||
63 | if (cc->p1_c == GNUNET_NO) | ||
64 | cc->p1_c = GNUNET_YES; | ||
65 | } | ||
66 | if (0 == memcmp (&(*peer).hashPubKey, &cc->p2->id.hashPubKey, sizeof (GNUNET_HashCode))) | ||
67 | { | ||
68 | if (cc->p2_c == GNUNET_NO) | ||
69 | cc->p2_c = GNUNET_YES; | ||
70 | } | ||
71 | |||
72 | if ((cc->p2_c == GNUNET_YES) && (cc->p2_c == GNUNET_YES)) | ||
63 | { | 73 | { |
64 | /* clean up */ | 74 | /* clean up */ |
65 | GNUNET_TRANSPORT_get_hello_cancel (cc->th_p2, &exchange_hello_last, cc); | 75 | GNUNET_TRANSPORT_get_hello_cancel (cc->th_p2, &exchange_hello_last, cc); |
@@ -70,15 +80,14 @@ notify_connect_internal (void *cls, | |||
70 | 80 | ||
71 | cc->tct = GNUNET_SCHEDULER_NO_TASK; | 81 | cc->tct = GNUNET_SCHEDULER_NO_TASK; |
72 | 82 | ||
73 | GNUNET_TRANSPORT_disconnect( cc->th_p1); | 83 | GNUNET_TRANSPORT_disconnect (cc->th_p1); |
74 | GNUNET_TRANSPORT_disconnect( cc->th_p2); | 84 | GNUNET_TRANSPORT_disconnect (cc->th_p2); |
75 | 85 | ||
76 | if (cc->cb != NULL) | 86 | if (cc->cb != NULL) |
77 | cc->cb (cc->p1, cc->p2, cc->cb_cls); | 87 | cc->cb (cc->p1, cc->p2, cc->cb_cls); |
78 | 88 | ||
79 | GNUNET_free(cc); | 89 | GNUNET_free(cc); |
80 | } | 90 | } |
81 | |||
82 | } | 91 | } |
83 | 92 | ||
84 | static void | 93 | static void |