diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/dht/gnunet-service-dht_routing.c | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/dht/gnunet-service-dht_routing.c')
-rw-r--r-- | src/dht/gnunet-service-dht_routing.c | 396 |
1 files changed, 199 insertions, 197 deletions
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index 1cee45a22..99c6b5e4f 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file dht/gnunet-service-dht_routing.c | 22 | * @file dht/gnunet-service-dht_routing.c |
@@ -39,9 +39,7 @@ | |||
39 | * Information we keep about all recent GET requests | 39 | * Information we keep about all recent GET requests |
40 | * so that we can route replies. | 40 | * so that we can route replies. |
41 | */ | 41 | */ |
42 | struct RecentRequest | 42 | struct RecentRequest { |
43 | { | ||
44 | |||
45 | /** | 43 | /** |
46 | * The peer this request was received from. | 44 | * The peer this request was received from. |
47 | */ | 45 | */ |
@@ -82,7 +80,6 @@ struct RecentRequest | |||
82 | * Request options. | 80 | * Request options. |
83 | */ | 81 | */ |
84 | enum GNUNET_DHT_RouteOption options; | 82 | enum GNUNET_DHT_RouteOption options; |
85 | |||
86 | }; | 83 | }; |
87 | 84 | ||
88 | 85 | ||
@@ -100,8 +97,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *recent_map; | |||
100 | /** | 97 | /** |
101 | * Closure for the 'process' function. | 98 | * Closure for the 'process' function. |
102 | */ | 99 | */ |
103 | struct ProcessContext | 100 | struct ProcessContext { |
104 | { | ||
105 | /** | 101 | /** |
106 | * Path of the original PUT | 102 | * Path of the original PUT |
107 | */ | 103 | */ |
@@ -141,7 +137,6 @@ struct ProcessContext | |||
141 | * Type of the reply. | 137 | * Type of the reply. |
142 | */ | 138 | */ |
143 | enum GNUNET_BLOCK_Type type; | 139 | enum GNUNET_BLOCK_Type type; |
144 | |||
145 | }; | 140 | }; |
146 | 141 | ||
147 | 142 | ||
@@ -155,9 +150,9 @@ struct ProcessContext | |||
155 | * #GNUNET_SYSERR if the result is malformed or type unsupported | 150 | * #GNUNET_SYSERR if the result is malformed or type unsupported |
156 | */ | 151 | */ |
157 | static int | 152 | static int |
158 | process (void *cls, | 153 | process(void *cls, |
159 | const struct GNUNET_HashCode *key, | 154 | const struct GNUNET_HashCode *key, |
160 | void *value) | 155 | void *value) |
161 | { | 156 | { |
162 | struct ProcessContext *pc = cls; | 157 | struct ProcessContext *pc = cls; |
163 | struct RecentRequest *rr = value; | 158 | struct RecentRequest *rr = value; |
@@ -167,104 +162,111 @@ process (void *cls, | |||
167 | struct GNUNET_HashCode hc; | 162 | struct GNUNET_HashCode hc; |
168 | const struct GNUNET_HashCode *eval_key; | 163 | const struct GNUNET_HashCode *eval_key; |
169 | 164 | ||
170 | if ( (rr->type != GNUNET_BLOCK_TYPE_ANY) && | 165 | if ((rr->type != GNUNET_BLOCK_TYPE_ANY) && |
171 | (rr->type != pc->type) ) | 166 | (rr->type != pc->type)) |
172 | return GNUNET_OK; /* type missmatch */ | 167 | return GNUNET_OK; /* type missmatch */ |
173 | 168 | ||
174 | if (0 != (rr->options & GNUNET_DHT_RO_RECORD_ROUTE)) | 169 | if (0 != (rr->options & GNUNET_DHT_RO_RECORD_ROUTE)) |
175 | { | 170 | { |
176 | gpl = pc->get_path_length; | 171 | gpl = pc->get_path_length; |
177 | ppl = pc->put_path_length; | 172 | ppl = pc->put_path_length; |
178 | } | 173 | } |
179 | else | 174 | else |
180 | { | 175 | { |
181 | gpl = 0; | 176 | gpl = 0; |
182 | ppl = 0; | 177 | ppl = 0; |
183 | } | 178 | } |
184 | if ( (0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && | 179 | if ((0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && |
185 | (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO) ) | 180 | (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO)) |
186 | { | 181 | { |
187 | /* key may not match HELLO, which is OK since | 182 | /* key may not match HELLO, which is OK since |
188 | * the search is approximate. Still, the evaluation | 183 | * the search is approximate. Still, the evaluation |
189 | * would fail since the match is not exact. So | 184 | * would fail since the match is not exact. So |
190 | * we fake it by changing the key to the actual PID ... */ | 185 | * we fake it by changing the key to the actual PID ... */ |
191 | GNUNET_BLOCK_get_key (GDS_block_context, | 186 | GNUNET_BLOCK_get_key(GDS_block_context, |
192 | GNUNET_BLOCK_TYPE_DHT_HELLO, | 187 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
193 | pc->data, | 188 | pc->data, |
194 | pc->data_size, | 189 | pc->data_size, |
195 | &hc); | 190 | &hc); |
196 | eval_key = &hc; | 191 | eval_key = &hc; |
197 | } | 192 | } |
198 | else | 193 | else |
199 | { | 194 | { |
200 | eval_key = key; | 195 | eval_key = key; |
201 | } | 196 | } |
202 | eval | 197 | eval |
203 | = GNUNET_BLOCK_evaluate (GDS_block_context, | 198 | = GNUNET_BLOCK_evaluate(GDS_block_context, |
204 | pc->type, | 199 | pc->type, |
205 | rr->bg, | 200 | rr->bg, |
206 | GNUNET_BLOCK_EO_NONE, | 201 | GNUNET_BLOCK_EO_NONE, |
207 | eval_key, | 202 | eval_key, |
208 | rr->xquery, | 203 | rr->xquery, |
209 | rr->xquery_size, | 204 | rr->xquery_size, |
210 | pc->data, | 205 | pc->data, |
211 | pc->data_size); | 206 | pc->data_size); |
212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 207 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
213 | "Result for %s of type %d was evaluated as %d\n", | 208 | "Result for %s of type %d was evaluated as %d\n", |
214 | GNUNET_h2s (key), | 209 | GNUNET_h2s(key), |
215 | pc->type, | 210 | pc->type, |
216 | eval); | 211 | eval); |
217 | switch (eval) | 212 | switch (eval) |
218 | { | 213 | { |
219 | case GNUNET_BLOCK_EVALUATION_OK_MORE: | 214 | case GNUNET_BLOCK_EVALUATION_OK_MORE: |
220 | case GNUNET_BLOCK_EVALUATION_OK_LAST: | 215 | case GNUNET_BLOCK_EVALUATION_OK_LAST: |
221 | GNUNET_STATISTICS_update (GDS_stats, | 216 | GNUNET_STATISTICS_update(GDS_stats, |
222 | gettext_noop | 217 | gettext_noop |
223 | ("# Good REPLIES matched against routing table"), | 218 | ("# Good REPLIES matched against routing table"), |
224 | 1, GNUNET_NO); | 219 | 1, GNUNET_NO); |
225 | GDS_NEIGHBOURS_handle_reply (&rr->peer, | 220 | GDS_NEIGHBOURS_handle_reply(&rr->peer, |
226 | pc->type, | 221 | pc->type, |
227 | pc->expiration_time, | 222 | pc->expiration_time, |
228 | key, | 223 | key, |
229 | ppl, pc->put_path, | 224 | ppl, pc->put_path, |
230 | gpl, pc->get_path, | 225 | gpl, pc->get_path, |
231 | pc->data, | 226 | pc->data, |
232 | pc->data_size); | 227 | pc->data_size); |
233 | break; | 228 | break; |
234 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: | 229 | |
235 | GNUNET_STATISTICS_update (GDS_stats, | 230 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: |
236 | gettext_noop | 231 | GNUNET_STATISTICS_update(GDS_stats, |
237 | ("# Duplicate REPLIES matched against routing table"), | 232 | gettext_noop |
238 | 1, GNUNET_NO); | 233 | ("# Duplicate REPLIES matched against routing table"), |
239 | return GNUNET_OK; | 234 | 1, GNUNET_NO); |
240 | case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: | 235 | return GNUNET_OK; |
241 | GNUNET_STATISTICS_update (GDS_stats, | 236 | |
242 | gettext_noop | 237 | case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: |
243 | ("# Invalid REPLIES matched against routing table"), | 238 | GNUNET_STATISTICS_update(GDS_stats, |
244 | 1, GNUNET_NO); | 239 | gettext_noop |
245 | return GNUNET_SYSERR; | 240 | ("# Invalid REPLIES matched against routing table"), |
246 | case GNUNET_BLOCK_EVALUATION_RESULT_IRRELEVANT: | 241 | 1, GNUNET_NO); |
247 | GNUNET_STATISTICS_update (GDS_stats, | 242 | return GNUNET_SYSERR; |
248 | gettext_noop | 243 | |
249 | ("# Irrelevant REPLIES matched against routing table"), | 244 | case GNUNET_BLOCK_EVALUATION_RESULT_IRRELEVANT: |
250 | 1, GNUNET_NO); | 245 | GNUNET_STATISTICS_update(GDS_stats, |
251 | return GNUNET_OK; | 246 | gettext_noop |
252 | case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: | 247 | ("# Irrelevant REPLIES matched against routing table"), |
253 | GNUNET_break (0); | 248 | 1, GNUNET_NO); |
254 | return GNUNET_OK; | 249 | return GNUNET_OK; |
255 | case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID: | 250 | |
256 | GNUNET_break (0); | 251 | case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: |
257 | return GNUNET_OK; | 252 | GNUNET_break(0); |
258 | case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: | 253 | return GNUNET_OK; |
259 | GNUNET_STATISTICS_update (GDS_stats, | 254 | |
260 | gettext_noop | 255 | case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID: |
261 | ("# Unsupported REPLIES matched against routing table"), | 256 | GNUNET_break(0); |
262 | 1, GNUNET_NO); | 257 | return GNUNET_OK; |
263 | return GNUNET_SYSERR; | 258 | |
264 | default: | 259 | case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: |
265 | GNUNET_break (0); | 260 | GNUNET_STATISTICS_update(GDS_stats, |
266 | return GNUNET_SYSERR; | 261 | gettext_noop |
267 | } | 262 | ("# Unsupported REPLIES matched against routing table"), |
263 | 1, GNUNET_NO); | ||
264 | return GNUNET_SYSERR; | ||
265 | |||
266 | default: | ||
267 | GNUNET_break(0); | ||
268 | return GNUNET_SYSERR; | ||
269 | } | ||
268 | return GNUNET_OK; | 270 | return GNUNET_OK; |
269 | } | 271 | } |
270 | 272 | ||
@@ -287,15 +289,15 @@ process (void *cls, | |||
287 | * @param data_size number of bytes in data | 289 | * @param data_size number of bytes in data |
288 | */ | 290 | */ |
289 | void | 291 | void |
290 | GDS_ROUTING_process (enum GNUNET_BLOCK_Type type, | 292 | GDS_ROUTING_process(enum GNUNET_BLOCK_Type type, |
291 | struct GNUNET_TIME_Absolute expiration_time, | 293 | struct GNUNET_TIME_Absolute expiration_time, |
292 | const struct GNUNET_HashCode *key, | 294 | const struct GNUNET_HashCode *key, |
293 | unsigned int put_path_length, | 295 | unsigned int put_path_length, |
294 | const struct GNUNET_PeerIdentity *put_path, | 296 | const struct GNUNET_PeerIdentity *put_path, |
295 | unsigned int get_path_length, | 297 | unsigned int get_path_length, |
296 | const struct GNUNET_PeerIdentity *get_path, | 298 | const struct GNUNET_PeerIdentity *get_path, |
297 | const void *data, | 299 | const void *data, |
298 | size_t data_size) | 300 | size_t data_size) |
299 | { | 301 | { |
300 | struct ProcessContext pc; | 302 | struct ProcessContext pc; |
301 | 303 | ||
@@ -308,19 +310,19 @@ GDS_ROUTING_process (enum GNUNET_BLOCK_Type type, | |||
308 | pc.data = data; | 310 | pc.data = data; |
309 | pc.data_size = data_size; | 311 | pc.data_size = data_size; |
310 | if (NULL == data) | 312 | if (NULL == data) |
311 | { | 313 | { |
312 | /* Some apps might have an 'empty' reply as a valid reply; however, | 314 | /* Some apps might have an 'empty' reply as a valid reply; however, |
313 | 'process' will call GNUNET_BLOCK_evaluate' which treats a 'NULL' | 315 | 'process' will call GNUNET_BLOCK_evaluate' which treats a 'NULL' |
314 | reply as request-validation (but we need response-validation). | 316 | reply as request-validation (but we need response-validation). |
315 | So we set 'data' to a 0-byte non-NULL value just to be sure */ | 317 | So we set 'data' to a 0-byte non-NULL value just to be sure */ |
316 | GNUNET_break (0 == data_size); | 318 | GNUNET_break(0 == data_size); |
317 | pc.data_size = 0; | 319 | pc.data_size = 0; |
318 | pc.data = ""; /* something not null */ | 320 | pc.data = ""; /* something not null */ |
319 | } | 321 | } |
320 | GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, | 322 | GNUNET_CONTAINER_multihashmap_get_multiple(recent_map, |
321 | key, | 323 | key, |
322 | &process, | 324 | &process, |
323 | &pc); | 325 | &pc); |
324 | } | 326 | } |
325 | 327 | ||
326 | 328 | ||
@@ -330,23 +332,23 @@ GDS_ROUTING_process (enum GNUNET_BLOCK_Type type, | |||
330 | * in the heap and hashmap. | 332 | * in the heap and hashmap. |
331 | */ | 333 | */ |
332 | static void | 334 | static void |
333 | expire_oldest_entry () | 335 | expire_oldest_entry() |
334 | { | 336 | { |
335 | struct RecentRequest *recent_req; | 337 | struct RecentRequest *recent_req; |
336 | 338 | ||
337 | GNUNET_STATISTICS_update (GDS_stats, | 339 | GNUNET_STATISTICS_update(GDS_stats, |
338 | gettext_noop | 340 | gettext_noop |
339 | ("# Entries removed from routing table"), 1, | 341 | ("# Entries removed from routing table"), 1, |
340 | GNUNET_NO); | 342 | GNUNET_NO); |
341 | recent_req = GNUNET_CONTAINER_heap_peek (recent_heap); | 343 | recent_req = GNUNET_CONTAINER_heap_peek(recent_heap); |
342 | GNUNET_assert (recent_req != NULL); | 344 | GNUNET_assert(recent_req != NULL); |
343 | GNUNET_CONTAINER_heap_remove_node (recent_req->heap_node); | 345 | GNUNET_CONTAINER_heap_remove_node(recent_req->heap_node); |
344 | GNUNET_BLOCK_group_destroy (recent_req->bg); | 346 | GNUNET_BLOCK_group_destroy(recent_req->bg); |
345 | GNUNET_assert (GNUNET_YES == | 347 | GNUNET_assert(GNUNET_YES == |
346 | GNUNET_CONTAINER_multihashmap_remove (recent_map, | 348 | GNUNET_CONTAINER_multihashmap_remove(recent_map, |
347 | &recent_req->key, | 349 | &recent_req->key, |
348 | recent_req)); | 350 | recent_req)); |
349 | GNUNET_free (recent_req); | 351 | GNUNET_free(recent_req); |
350 | } | 352 | } |
351 | 353 | ||
352 | 354 | ||
@@ -361,26 +363,26 @@ expire_oldest_entry () | |||
361 | * #GNUNET_SYSERR if the request was successfully combined | 363 | * #GNUNET_SYSERR if the request was successfully combined |
362 | */ | 364 | */ |
363 | static int | 365 | static int |
364 | try_combine_recent (void *cls, | 366 | try_combine_recent(void *cls, |
365 | const struct GNUNET_HashCode *key, | 367 | const struct GNUNET_HashCode *key, |
366 | void *value) | 368 | void *value) |
367 | { | 369 | { |
368 | struct RecentRequest *in = cls; | 370 | struct RecentRequest *in = cls; |
369 | struct RecentRequest *rr = value; | 371 | struct RecentRequest *rr = value; |
370 | 372 | ||
371 | if ( (0 != GNUNET_memcmp (&in->peer, | 373 | if ((0 != GNUNET_memcmp(&in->peer, |
372 | &rr->peer)) || | 374 | &rr->peer)) || |
373 | (in->type != rr->type) || | 375 | (in->type != rr->type) || |
374 | (in->xquery_size != rr->xquery_size) || | 376 | (in->xquery_size != rr->xquery_size) || |
375 | (0 != memcmp (in->xquery, | 377 | (0 != memcmp(in->xquery, |
376 | rr->xquery, | 378 | rr->xquery, |
377 | in->xquery_size)) ) | 379 | in->xquery_size))) |
378 | return GNUNET_OK; | 380 | return GNUNET_OK; |
379 | GNUNET_break (GNUNET_SYSERR != | 381 | GNUNET_break(GNUNET_SYSERR != |
380 | GNUNET_BLOCK_group_merge (in->bg, | 382 | GNUNET_BLOCK_group_merge(in->bg, |
381 | rr->bg)); | 383 | rr->bg)); |
382 | rr->bg = in->bg; | 384 | rr->bg = in->bg; |
383 | GNUNET_free (in); | 385 | GNUNET_free(in); |
384 | return GNUNET_SYSERR; | 386 | return GNUNET_SYSERR; |
385 | } | 387 | } |
386 | 388 | ||
@@ -398,53 +400,53 @@ try_combine_recent (void *cls, | |||
398 | * @param reply_bf_mutator mutator for @a reply_bf | 400 | * @param reply_bf_mutator mutator for @a reply_bf |
399 | */ | 401 | */ |
400 | void | 402 | void |
401 | GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | 403 | GDS_ROUTING_add(const struct GNUNET_PeerIdentity *sender, |
402 | enum GNUNET_BLOCK_Type type, | 404 | enum GNUNET_BLOCK_Type type, |
403 | struct GNUNET_BLOCK_Group *bg, | 405 | struct GNUNET_BLOCK_Group *bg, |
404 | enum GNUNET_DHT_RouteOption options, | 406 | enum GNUNET_DHT_RouteOption options, |
405 | const struct GNUNET_HashCode *key, | 407 | const struct GNUNET_HashCode *key, |
406 | const void *xquery, | 408 | const void *xquery, |
407 | size_t xquery_size) | 409 | size_t xquery_size) |
408 | { | 410 | { |
409 | struct RecentRequest *recent_req; | 411 | struct RecentRequest *recent_req; |
410 | 412 | ||
411 | while (GNUNET_CONTAINER_heap_get_size (recent_heap) >= DHT_MAX_RECENT) | 413 | while (GNUNET_CONTAINER_heap_get_size(recent_heap) >= DHT_MAX_RECENT) |
412 | expire_oldest_entry (); | 414 | expire_oldest_entry(); |
413 | GNUNET_STATISTICS_update (GDS_stats, | 415 | GNUNET_STATISTICS_update(GDS_stats, |
414 | gettext_noop ("# Entries added to routing table"), | 416 | gettext_noop("# Entries added to routing table"), |
415 | 1, | 417 | 1, |
416 | GNUNET_NO); | 418 | GNUNET_NO); |
417 | recent_req = GNUNET_malloc (sizeof (struct RecentRequest) + xquery_size); | 419 | recent_req = GNUNET_malloc(sizeof(struct RecentRequest) + xquery_size); |
418 | recent_req->peer = *sender; | 420 | recent_req->peer = *sender; |
419 | recent_req->key = *key; | 421 | recent_req->key = *key; |
420 | recent_req->bg = bg; | 422 | recent_req->bg = bg; |
421 | recent_req->type = type; | 423 | recent_req->type = type; |
422 | recent_req->options = options; | 424 | recent_req->options = options; |
423 | recent_req->xquery = &recent_req[1]; | 425 | recent_req->xquery = &recent_req[1]; |
424 | GNUNET_memcpy (&recent_req[1], | 426 | GNUNET_memcpy(&recent_req[1], |
425 | xquery, | 427 | xquery, |
426 | xquery_size); | 428 | xquery_size); |
427 | recent_req->xquery_size = xquery_size; | 429 | recent_req->xquery_size = xquery_size; |
428 | if (GNUNET_SYSERR == | 430 | if (GNUNET_SYSERR == |
429 | GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, | 431 | GNUNET_CONTAINER_multihashmap_get_multiple(recent_map, |
430 | key, | 432 | key, |
431 | &try_combine_recent, | 433 | &try_combine_recent, |
432 | recent_req)) | 434 | recent_req)) |
433 | { | 435 | { |
434 | GNUNET_STATISTICS_update (GDS_stats, | 436 | GNUNET_STATISTICS_update(GDS_stats, |
435 | gettext_noop | 437 | gettext_noop |
436 | ("# DHT requests combined"), | 438 | ("# DHT requests combined"), |
437 | 1, GNUNET_NO); | 439 | 1, GNUNET_NO); |
438 | return; | 440 | return; |
439 | } | 441 | } |
440 | recent_req->heap_node | 442 | recent_req->heap_node |
441 | = GNUNET_CONTAINER_heap_insert (recent_heap, | 443 | = GNUNET_CONTAINER_heap_insert(recent_heap, |
444 | recent_req, | ||
445 | GNUNET_TIME_absolute_get().abs_value_us); | ||
446 | GNUNET_CONTAINER_multihashmap_put(recent_map, | ||
447 | key, | ||
442 | recent_req, | 448 | recent_req, |
443 | GNUNET_TIME_absolute_get ().abs_value_us); | 449 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
444 | GNUNET_CONTAINER_multihashmap_put (recent_map, | ||
445 | key, | ||
446 | recent_req, | ||
447 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
448 | } | 450 | } |
449 | 451 | ||
450 | 452 | ||
@@ -452,10 +454,10 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | |||
452 | * Initialize routing subsystem. | 454 | * Initialize routing subsystem. |
453 | */ | 455 | */ |
454 | void | 456 | void |
455 | GDS_ROUTING_init () | 457 | GDS_ROUTING_init() |
456 | { | 458 | { |
457 | recent_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 459 | recent_heap = GNUNET_CONTAINER_heap_create(GNUNET_CONTAINER_HEAP_ORDER_MIN); |
458 | recent_map = GNUNET_CONTAINER_multihashmap_create (DHT_MAX_RECENT * 4 / 3, GNUNET_NO); | 460 | recent_map = GNUNET_CONTAINER_multihashmap_create(DHT_MAX_RECENT * 4 / 3, GNUNET_NO); |
459 | } | 461 | } |
460 | 462 | ||
461 | 463 | ||
@@ -463,15 +465,15 @@ GDS_ROUTING_init () | |||
463 | * Shutdown routing subsystem. | 465 | * Shutdown routing subsystem. |
464 | */ | 466 | */ |
465 | void | 467 | void |
466 | GDS_ROUTING_done () | 468 | GDS_ROUTING_done() |
467 | { | 469 | { |
468 | while (GNUNET_CONTAINER_heap_get_size (recent_heap) > 0) | 470 | while (GNUNET_CONTAINER_heap_get_size(recent_heap) > 0) |
469 | expire_oldest_entry (); | 471 | expire_oldest_entry(); |
470 | GNUNET_assert (0 == GNUNET_CONTAINER_heap_get_size (recent_heap)); | 472 | GNUNET_assert(0 == GNUNET_CONTAINER_heap_get_size(recent_heap)); |
471 | GNUNET_CONTAINER_heap_destroy (recent_heap); | 473 | GNUNET_CONTAINER_heap_destroy(recent_heap); |
472 | recent_heap = NULL; | 474 | recent_heap = NULL; |
473 | GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (recent_map)); | 475 | GNUNET_assert(0 == GNUNET_CONTAINER_multihashmap_size(recent_map)); |
474 | GNUNET_CONTAINER_multihashmap_destroy (recent_map); | 476 | GNUNET_CONTAINER_multihashmap_destroy(recent_map); |
475 | recent_map = NULL; | 477 | recent_map = NULL; |
476 | } | 478 | } |
477 | 479 | ||