diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-21 19:57:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-21 19:57:04 +0000 |
commit | a06d7742d5a48229767c152f9466432d17e162de (patch) | |
tree | 4ad0f49b6322583bb52eccf078de89f6d133eb02 /src/peerinfo/test_peerinfo_api.c | |
parent | 7a6bb78122b5ec18dc9887f8d636db29cfa14781 (diff) | |
download | gnunet-a06d7742d5a48229767c152f9466432d17e162de.tar.gz gnunet-a06d7742d5a48229767c152f9466432d17e162de.zip |
migrating testcase
Diffstat (limited to 'src/peerinfo/test_peerinfo_api.c')
-rw-r--r-- | src/peerinfo/test_peerinfo_api.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c index 973838006..10ea1fa81 100644 --- a/src/peerinfo/test_peerinfo_api.c +++ b/src/peerinfo/test_peerinfo_api.c | |||
@@ -40,7 +40,9 @@ static struct GNUNET_SCHEDULER_Handle *sched; | |||
40 | 40 | ||
41 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 41 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
42 | 42 | ||
43 | static struct GNUNET_PEERINFO_IteratorContext *ic; | 43 | static struct GNUNET_PEERINFO_NewIteratorContext *ic; |
44 | |||
45 | static struct GNUNET_PEERINFO_Handle *h; | ||
44 | 46 | ||
45 | static unsigned int retries; | 47 | static unsigned int retries; |
46 | 48 | ||
@@ -91,7 +93,7 @@ add_peer () | |||
91 | memset (&pkey, 32, sizeof (pkey)); | 93 | memset (&pkey, 32, sizeof (pkey)); |
92 | GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey); | 94 | GNUNET_CRYPTO_hash (&pkey, sizeof (pkey), &pid.hashPubKey); |
93 | h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc); | 95 | h2 = GNUNET_HELLO_create (&pkey, &address_generator, &agc); |
94 | GNUNET_PEERINFO_add_peer (cfg, sched, &pid, h2); | 96 | GNUNET_PEERINFO_add_peer_new (h, h2); |
95 | GNUNET_free (h2); | 97 | GNUNET_free (h2); |
96 | 98 | ||
97 | } | 99 | } |
@@ -114,18 +116,19 @@ process (void *cls, | |||
114 | /* try again */ | 116 | /* try again */ |
115 | retries++; | 117 | retries++; |
116 | add_peer (); | 118 | add_peer (); |
117 | ic = GNUNET_PEERINFO_iterate (cfg, | 119 | ic = GNUNET_PEERINFO_iterate_new (h, |
118 | sched, | 120 | NULL, |
119 | NULL, | 121 | 0, |
120 | 0, | 122 | GNUNET_TIME_relative_multiply |
121 | GNUNET_TIME_relative_multiply | 123 | (GNUNET_TIME_UNIT_SECONDS, 15), |
122 | (GNUNET_TIME_UNIT_SECONDS, 15), | 124 | &process, cls); |
123 | &process, cls); | ||
124 | return; | 125 | return; |
125 | } | 126 | } |
126 | GNUNET_assert (peer == NULL); | 127 | GNUNET_assert (peer == NULL); |
127 | GNUNET_assert (2 == *ok); | 128 | GNUNET_assert (2 == *ok); |
128 | GNUNET_assert (trust == 0); | 129 | GNUNET_assert (trust == 0); |
130 | GNUNET_PEERINFO_disconnect (h); | ||
131 | h = NULL; | ||
129 | *ok = 0; | 132 | *ok = 0; |
130 | return; | 133 | return; |
131 | } | 134 | } |
@@ -149,13 +152,14 @@ run (void *cls, | |||
149 | { | 152 | { |
150 | sched = s; | 153 | sched = s; |
151 | cfg = c; | 154 | cfg = c; |
155 | h = GNUNET_PEERINFO_connect (cfg, sched); | ||
152 | add_peer (); | 156 | add_peer (); |
153 | ic = GNUNET_PEERINFO_iterate (cfg, | 157 | ic = GNUNET_PEERINFO_iterate_new (h, |
154 | sched, | 158 | NULL, |
155 | NULL, | 159 | 0, |
156 | 0, | 160 | GNUNET_TIME_relative_multiply |
157 | GNUNET_TIME_relative_multiply | 161 | (GNUNET_TIME_UNIT_SECONDS, 15), |
158 | (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls); | 162 | &process, cls); |
159 | } | 163 | } |
160 | 164 | ||
161 | 165 | ||