diff options
-rw-r--r-- | src/revocation/revocation_api.c | 302 | ||||
-rw-r--r-- | src/revocation/test_revocation.c | 14 |
2 files changed, 128 insertions, 188 deletions
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 32819a7ae..57431f250 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2013 GNUnet e.V. | 3 | Copyright (C) 2013, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public Licerevocation as published | 6 | it under the terms of the GNU General Public Licerevocation as published |
@@ -37,19 +37,9 @@ struct GNUNET_REVOCATION_Query | |||
37 | { | 37 | { |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Connection to the service. | 40 | * Message queue to the service. |
41 | */ | 41 | */ |
42 | struct GNUNET_CLIENT_Connection *client; | 42 | struct GNUNET_MQ_Handle *mq; |
43 | |||
44 | /** | ||
45 | * Our configuration. | ||
46 | */ | ||
47 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
48 | |||
49 | /** | ||
50 | * Key to check. | ||
51 | */ | ||
52 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | ||
53 | 43 | ||
54 | /** | 44 | /** |
55 | * Function to call with the result. | 45 | * Function to call with the result. |
@@ -61,77 +51,50 @@ struct GNUNET_REVOCATION_Query | |||
61 | */ | 51 | */ |
62 | void *func_cls; | 52 | void *func_cls; |
63 | 53 | ||
64 | /** | ||
65 | * Transmission handle to the service. | ||
66 | */ | ||
67 | struct GNUNET_CLIENT_TransmitHandle *th; | ||
68 | |||
69 | }; | 54 | }; |
70 | 55 | ||
71 | 56 | ||
72 | /** | 57 | /** |
73 | * Handle response to our revocation query. | 58 | * Generic error handler, called with the appropriate |
59 | * error code and the same closure specified at the creation of | ||
60 | * the message queue. | ||
61 | * Not every message queue implementation supports an error handler. | ||
74 | * | 62 | * |
75 | * @param cls our `struct GNUNET_REVOCATION_Query` handle | 63 | * @param cls closure with the `struct GNUNET_NSE_Handle *` |
76 | * @param msg response we got, NULL on disconnect | 64 | * @param error error code |
77 | */ | 65 | */ |
78 | static void | 66 | static void |
79 | handle_revocation_query_response (void *cls, | 67 | query_mq_error_handler (void *cls, |
80 | const struct GNUNET_MessageHeader *msg) | 68 | enum GNUNET_MQ_Error error) |
81 | { | 69 | { |
82 | struct GNUNET_REVOCATION_Query *q = cls; | 70 | struct GNUNET_REVOCATION_Query *q = cls; |
83 | const struct QueryResponseMessage *qrm; | ||
84 | 71 | ||
85 | if ( (NULL == msg) || | 72 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
86 | (sizeof (struct QueryResponseMessage) != ntohs (msg->size)) || | 73 | "Revocation query MQ error\n"); |
87 | (GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE != ntohs (msg->type)) ) | 74 | q->func (q->func_cls, |
88 | { | 75 | GNUNET_SYSERR); |
89 | GNUNET_break (NULL == msg); | ||
90 | q->func (q->func_cls, GNUNET_SYSERR); | ||
91 | GNUNET_REVOCATION_query_cancel (q); | ||
92 | return; | ||
93 | } | ||
94 | qrm = (const struct QueryResponseMessage *) msg; | ||
95 | q->func (q->func_cls, ntohl (qrm->is_valid)); | ||
96 | GNUNET_REVOCATION_query_cancel (q); | 76 | GNUNET_REVOCATION_query_cancel (q); |
97 | } | 77 | } |
98 | 78 | ||
99 | 79 | ||
100 | /** | 80 | /** |
101 | * Transmit our revocation query to the service. | 81 | * Handle response to our revocation query. |
102 | * | 82 | * |
103 | * @param cls our `struct GNUNET_REVOCATION_Query` handle | 83 | * @param cls our `struct GNUNET_REVOCATION_Query` handle |
104 | * @param size number of bytes available in @a buf | 84 | * @param qrm response we got |
105 | * @param buf where to copy the query | ||
106 | * @return number of bytes copied to @a buf | ||
107 | */ | 85 | */ |
108 | static size_t | 86 | static void |
109 | send_revocation_query (void *cls, | 87 | handle_revocation_query_response (void *cls, |
110 | size_t size, | 88 | const struct QueryResponseMessage *qrm) |
111 | void *buf) | ||
112 | { | 89 | { |
113 | struct GNUNET_REVOCATION_Query *q = cls; | 90 | struct GNUNET_REVOCATION_Query *q = cls; |
114 | struct QueryMessage qm; | ||
115 | 91 | ||
116 | q->th = NULL; | 92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
117 | if ( (NULL == buf) || | 93 | "Revocation query result: %d\n", |
118 | (sizeof (struct QueryMessage) > size) ) | 94 | ntohl (qrm->is_valid)); |
119 | { | 95 | q->func (q->func_cls, |
120 | GNUNET_break (0); | 96 | ntohl (qrm->is_valid)); |
121 | q->func (q->func_cls, GNUNET_SYSERR); | 97 | GNUNET_REVOCATION_query_cancel (q); |
122 | GNUNET_REVOCATION_query_cancel (q); | ||
123 | return 0; | ||
124 | } | ||
125 | qm.header.size = htons (sizeof (struct QueryMessage)); | ||
126 | qm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_QUERY); | ||
127 | qm.reserved = htonl (0); | ||
128 | qm.key = q->key; | ||
129 | memcpy (buf, &qm, sizeof (struct QueryMessage)); | ||
130 | GNUNET_CLIENT_receive (q->client, | ||
131 | &handle_revocation_query_response, | ||
132 | q, | ||
133 | GNUNET_TIME_UNIT_FOREVER_REL); | ||
134 | return sizeof (struct QueryMessage); | ||
135 | } | 98 | } |
136 | 99 | ||
137 | 100 | ||
@@ -147,28 +110,39 @@ send_revocation_query (void *cls, | |||
147 | struct GNUNET_REVOCATION_Query * | 110 | struct GNUNET_REVOCATION_Query * |
148 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | 111 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, |
149 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 112 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
150 | GNUNET_REVOCATION_Callback func, void *func_cls) | 113 | GNUNET_REVOCATION_Callback func, |
114 | void *func_cls) | ||
151 | { | 115 | { |
152 | struct GNUNET_REVOCATION_Query *q; | 116 | GNUNET_MQ_hd_fixed_size (revocation_query_response, |
153 | 117 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE, | |
154 | q = GNUNET_new (struct GNUNET_REVOCATION_Query); | 118 | struct QueryResponseMessage); |
155 | q->client = GNUNET_CLIENT_connect ("revocation", cfg); | 119 | struct GNUNET_REVOCATION_Query *q |
156 | if (NULL == q->client) | 120 | = GNUNET_new (struct GNUNET_REVOCATION_Query); |
121 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
122 | make_revocation_query_response_handler (q), | ||
123 | GNUNET_MQ_handler_end () | ||
124 | }; | ||
125 | struct QueryMessage *qm; | ||
126 | struct GNUNET_MQ_Envelope *env; | ||
127 | |||
128 | q->mq = GNUNET_CLIENT_connecT (cfg, | ||
129 | "revocation", | ||
130 | handlers, | ||
131 | &query_mq_error_handler, | ||
132 | q); | ||
133 | if (NULL == q->mq) | ||
157 | { | 134 | { |
158 | GNUNET_break (0); | ||
159 | GNUNET_free (q); | 135 | GNUNET_free (q); |
160 | return NULL; | 136 | return NULL; |
161 | } | 137 | } |
162 | q->cfg = cfg; | ||
163 | q->key = *key; | ||
164 | q->func = func; | 138 | q->func = func; |
165 | q->func_cls = func_cls; | 139 | q->func_cls = func_cls; |
166 | q->th = GNUNET_CLIENT_notify_transmit_ready (q->client, | 140 | env = GNUNET_MQ_msg (qm, |
167 | sizeof (struct QueryMessage), | 141 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY); |
168 | GNUNET_TIME_UNIT_FOREVER_REL, | 142 | qm->reserved = htonl (0); |
169 | GNUNET_YES, | 143 | qm->key = *key; |
170 | &send_revocation_query, | 144 | GNUNET_MQ_send (q->mq, |
171 | q); | 145 | env); |
172 | return q; | 146 | return q; |
173 | } | 147 | } |
174 | 148 | ||
@@ -181,12 +155,11 @@ GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
181 | void | 155 | void |
182 | GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q) | 156 | GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q) |
183 | { | 157 | { |
184 | if (NULL != q->th) | 158 | if (NULL != q->mq) |
185 | { | 159 | { |
186 | GNUNET_CLIENT_notify_transmit_ready_cancel (q->th); | 160 | GNUNET_MQ_destroy (q->mq); |
187 | q->th = NULL; | 161 | q->mq = NULL; |
188 | } | 162 | } |
189 | GNUNET_CLIENT_disconnect (q->client); | ||
190 | GNUNET_free (q); | 163 | GNUNET_free (q); |
191 | } | 164 | } |
192 | 165 | ||
@@ -198,29 +171,9 @@ struct GNUNET_REVOCATION_Handle | |||
198 | { | 171 | { |
199 | 172 | ||
200 | /** | 173 | /** |
201 | * Connection to the service. | 174 | * Message queue to the service. |
202 | */ | ||
203 | struct GNUNET_CLIENT_Connection *client; | ||
204 | |||
205 | /** | ||
206 | * Our configuration. | ||
207 | */ | ||
208 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
209 | |||
210 | /** | ||
211 | * Key to revoke. | ||
212 | */ | ||
213 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | ||
214 | |||
215 | /** | ||
216 | * Signature showing that we have the right to revoke. | ||
217 | */ | ||
218 | struct GNUNET_CRYPTO_EcdsaSignature sig; | ||
219 | |||
220 | /** | ||
221 | * Proof of work showing that we spent enough resources to broadcast revocation. | ||
222 | */ | 175 | */ |
223 | uint64_t pow; | 176 | struct GNUNET_MQ_Handle *mq; |
224 | 177 | ||
225 | /** | 178 | /** |
226 | * Function to call once we are done. | 179 | * Function to call once we are done. |
@@ -232,83 +185,50 @@ struct GNUNET_REVOCATION_Handle | |||
232 | */ | 185 | */ |
233 | void *func_cls; | 186 | void *func_cls; |
234 | 187 | ||
235 | /** | ||
236 | * Transmission handle to the service. | ||
237 | */ | ||
238 | struct GNUNET_CLIENT_TransmitHandle *th; | ||
239 | |||
240 | }; | 188 | }; |
241 | 189 | ||
242 | 190 | ||
243 | /** | 191 | /** |
244 | * Handle response to our revocation query. | 192 | * Generic error handler, called with the appropriate |
193 | * error code and the same closure specified at the creation of | ||
194 | * the message queue. | ||
195 | * Not every message queue implementation supports an error handler. | ||
245 | * | 196 | * |
246 | * @param cls our `struct GNUNET_REVOCATION_Handle` handle | 197 | * @param cls closure with the `struct GNUNET_NSE_Handle *` |
247 | * @param msg response we got, NULL on disconnect | 198 | * @param error error code |
248 | */ | 199 | */ |
249 | static void | 200 | static void |
250 | handle_revocation_response (void *cls, | 201 | revocation_mq_error_handler (void *cls, |
251 | const struct GNUNET_MessageHeader *msg) | 202 | enum GNUNET_MQ_Error error) |
252 | { | 203 | { |
253 | struct GNUNET_REVOCATION_Handle *h = cls; | 204 | struct GNUNET_REVOCATION_Handle *h = cls; |
254 | const struct RevocationResponseMessage *rrm; | ||
255 | 205 | ||
256 | if ( (NULL == msg) || | 206 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
257 | (sizeof (struct RevocationResponseMessage) != ntohs (msg->size)) || | 207 | "Revocation MQ error\n"); |
258 | (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE != ntohs (msg->type)) ) | 208 | h->func (h->func_cls, |
259 | { | 209 | GNUNET_SYSERR); |
260 | GNUNET_break (NULL == msg); | ||
261 | h->func (h->func_cls, GNUNET_SYSERR); | ||
262 | GNUNET_REVOCATION_revoke_cancel (h); | ||
263 | return; | ||
264 | } | ||
265 | rrm = (const struct RevocationResponseMessage *) msg; | ||
266 | h->func (h->func_cls, ntohl (rrm->is_valid)); | ||
267 | GNUNET_REVOCATION_revoke_cancel (h); | 210 | GNUNET_REVOCATION_revoke_cancel (h); |
268 | |||
269 | } | 211 | } |
270 | 212 | ||
271 | 213 | ||
272 | /** | 214 | /** |
273 | * Transmit our revocation to the service. | 215 | * Handle response to our revocation query. |
274 | * | 216 | * |
275 | * @param cls our `struct GNUNET_REVOCATION_Handle` handle | 217 | * @param cls our `struct GNUNET_REVOCATION_Handle` handle |
276 | * @param size number of bytes available in @a buf | 218 | * @param rrm response we got |
277 | * @param buf where to copy the query | ||
278 | * @return number of bytes copied to @a buf | ||
279 | */ | 219 | */ |
280 | static size_t | 220 | static void |
281 | send_revoke (void *cls, | 221 | handle_revocation_response (void *cls, |
282 | size_t size, | 222 | const struct RevocationResponseMessage *rrm) |
283 | void *buf) | ||
284 | { | 223 | { |
285 | struct GNUNET_REVOCATION_Handle *h = cls; | 224 | struct GNUNET_REVOCATION_Handle *h = cls; |
286 | struct RevokeMessage rm; | ||
287 | 225 | ||
288 | h->th = NULL; | 226 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
289 | if ( (NULL == buf) || | 227 | "Revocation transmission result: %d\n", |
290 | (sizeof (struct RevokeMessage) > size) ) | 228 | ntohl (rrm->is_valid)); |
291 | { | 229 | h->func (h->func_cls, |
292 | GNUNET_break (0); | 230 | ntohl (rrm->is_valid)); |
293 | h->func (h->func_cls, GNUNET_SYSERR); | 231 | GNUNET_REVOCATION_revoke_cancel (h); |
294 | GNUNET_REVOCATION_revoke_cancel (h); | ||
295 | return 0; | ||
296 | } | ||
297 | rm.header.size = htons (sizeof (struct RevokeMessage)); | ||
298 | rm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); | ||
299 | rm.reserved = htonl (0); | ||
300 | rm.proof_of_work = h->pow; | ||
301 | rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | ||
302 | rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | ||
303 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | ||
304 | rm.public_key = h->key; | ||
305 | rm.signature = h->sig; | ||
306 | memcpy (buf, &rm, sizeof (struct RevokeMessage)); | ||
307 | GNUNET_CLIENT_receive (h->client, | ||
308 | &handle_revocation_response, | ||
309 | h, | ||
310 | GNUNET_TIME_UNIT_FOREVER_REL); | ||
311 | return sizeof (struct RevokeMessage); | ||
312 | } | 232 | } |
313 | 233 | ||
314 | 234 | ||
@@ -332,10 +252,21 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
332 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 252 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
333 | const struct GNUNET_CRYPTO_EcdsaSignature *sig, | 253 | const struct GNUNET_CRYPTO_EcdsaSignature *sig, |
334 | uint64_t pow, | 254 | uint64_t pow, |
335 | GNUNET_REVOCATION_Callback func, void *func_cls) | 255 | GNUNET_REVOCATION_Callback func, |
256 | void *func_cls) | ||
336 | { | 257 | { |
337 | struct GNUNET_REVOCATION_Handle *h; | 258 | GNUNET_MQ_hd_fixed_size (revocation_response, |
259 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE, | ||
260 | struct RevocationResponseMessage); | ||
261 | struct GNUNET_REVOCATION_Handle *h | ||
262 | = GNUNET_new (struct GNUNET_REVOCATION_Handle); | ||
263 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
264 | make_revocation_response_handler (h), | ||
265 | GNUNET_MQ_handler_end () | ||
266 | }; | ||
338 | unsigned long long matching_bits; | 267 | unsigned long long matching_bits; |
268 | struct RevokeMessage *rm; | ||
269 | struct GNUNET_MQ_Envelope *env; | ||
339 | 270 | ||
340 | if ( (GNUNET_OK == | 271 | if ( (GNUNET_OK == |
341 | GNUNET_CONFIGURATION_get_value_number (cfg, | 272 | GNUNET_CONFIGURATION_get_value_number (cfg, |
@@ -343,26 +274,38 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
343 | "WORKBITS", | 274 | "WORKBITS", |
344 | &matching_bits)) && | 275 | &matching_bits)) && |
345 | (GNUNET_YES != | 276 | (GNUNET_YES != |
346 | GNUNET_REVOCATION_check_pow (key, pow, | 277 | GNUNET_REVOCATION_check_pow (key, |
278 | pow, | ||
347 | (unsigned int) matching_bits)) ) | 279 | (unsigned int) matching_bits)) ) |
348 | { | 280 | { |
349 | GNUNET_break (0); | 281 | GNUNET_break (0); |
282 | GNUNET_free (h); | ||
283 | return NULL; | ||
284 | } | ||
285 | |||
286 | h->mq = GNUNET_CLIENT_connecT (cfg, | ||
287 | "revocation", | ||
288 | handlers, | ||
289 | &revocation_mq_error_handler, | ||
290 | h); | ||
291 | if (NULL == h->mq) | ||
292 | { | ||
293 | GNUNET_free (h); | ||
350 | return NULL; | 294 | return NULL; |
351 | } | 295 | } |
352 | h = GNUNET_new (struct GNUNET_REVOCATION_Handle); | ||
353 | h->client = GNUNET_CLIENT_connect ("revocation", cfg); | ||
354 | h->cfg = cfg; | ||
355 | h->key = *key; | ||
356 | h->sig = *sig; | ||
357 | h->pow = pow; | ||
358 | h->func = func; | 296 | h->func = func; |
359 | h->func_cls = func_cls; | 297 | h->func_cls = func_cls; |
360 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, | 298 | env = GNUNET_MQ_msg (rm, |
361 | sizeof (struct RevokeMessage), | 299 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); |
362 | GNUNET_TIME_UNIT_FOREVER_REL, | 300 | rm->reserved = htonl (0); |
363 | GNUNET_YES, | 301 | rm->proof_of_work = pow; |
364 | &send_revoke, | 302 | rm->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
365 | h); | 303 | rm->purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
304 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | ||
305 | rm->public_key = *key; | ||
306 | rm->signature = *sig; | ||
307 | GNUNET_MQ_send (h->mq, | ||
308 | env); | ||
366 | return h; | 309 | return h; |
367 | } | 310 | } |
368 | 311 | ||
@@ -375,17 +318,15 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
375 | void | 318 | void |
376 | GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) | 319 | GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) |
377 | { | 320 | { |
378 | if (NULL != h->th) | 321 | if (NULL != h->mq) |
379 | { | 322 | { |
380 | GNUNET_CLIENT_notify_transmit_ready_cancel (h->th); | 323 | GNUNET_MQ_destroy (h->mq); |
381 | h->th = NULL; | 324 | h->mq = NULL; |
382 | } | 325 | } |
383 | GNUNET_CLIENT_disconnect (h->client); | ||
384 | GNUNET_free (h); | 326 | GNUNET_free (h); |
385 | } | 327 | } |
386 | 328 | ||
387 | 329 | ||
388 | |||
389 | /** | 330 | /** |
390 | * Calculate the 'proof-of-work' hash (an expensive hash). | 331 | * Calculate the 'proof-of-work' hash (an expensive hash). |
391 | * | 332 | * |
@@ -478,4 +419,3 @@ GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *k | |||
478 | 419 | ||
479 | 420 | ||
480 | /* end of revocation_api.c */ | 421 | /* end of revocation_api.c */ |
481 | |||
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index 6d6db1b5c..e63486c8d 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2013 GNUnet e.V. | 3 | Copyright (C) 2009, 2013, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -260,11 +260,12 @@ identity_connect_adapter (void *cls, | |||
260 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 260 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
261 | { | 261 | { |
262 | struct TestPeer *me = cls; | 262 | struct TestPeer *me = cls; |
263 | |||
263 | me->cfg = cfg; | 264 | me->cfg = cfg; |
264 | me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL ); | 265 | me->idh = GNUNET_IDENTITY_connect (cfg, NULL, NULL); |
265 | if (NULL == me->idh) | 266 | if (NULL == me->idh) |
266 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 267 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
267 | "Failed to create IDENTITY handle \n"); | 268 | "Failed to create IDENTITY handle \n"); |
268 | return me->idh; | 269 | return me->idh; |
269 | } | 270 | } |
270 | 271 | ||
@@ -367,9 +368,8 @@ test_connection (void *cls, | |||
367 | { | 368 | { |
368 | unsigned int c; | 369 | unsigned int c; |
369 | 370 | ||
370 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, | 371 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
371 | &do_shutdown, NULL); | 372 | NULL); |
372 | |||
373 | if (NUM_TEST_PEERS != num_peers) | 373 | if (NUM_TEST_PEERS != num_peers) |
374 | { | 374 | { |
375 | ok = 4; | 375 | ok = 4; |