diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-03-07 19:10:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-03-07 19:10:51 +0000 |
commit | cd0ad4c559f9338eec2a152ded51d16e021eca06 (patch) | |
tree | 151c7e7b1483f4b50411e1fd30be1091cc7480bd /src | |
parent | 71c9ff44f0b1b1f6c3dc72e945644e47ab5ab921 (diff) | |
download | gnunet-cd0ad4c559f9338eec2a152ded51d16e021eca06.tar.gz gnunet-cd0ad4c559f9338eec2a152ded51d16e021eca06.zip |
-indentation and comment fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/datastore/datastore_api.c | 21 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_lc.c | 15 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 17 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 109 | ||||
-rw-r--r-- | src/set/gnunet-service-set_union.c | 30 | ||||
-rw-r--r-- | src/set/set_api.c | 3 |
6 files changed, 121 insertions, 74 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index 5a46b2039..67ca9a8ad 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -1409,13 +1409,15 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, | |||
1409 | * cancel | 1409 | * cancel |
1410 | */ | 1410 | */ |
1411 | struct GNUNET_DATASTORE_QueueEntry * | 1411 | struct GNUNET_DATASTORE_QueueEntry * |
1412 | GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset, | 1412 | GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, |
1413 | uint64_t offset, | ||
1413 | const struct GNUNET_HashCode * key, | 1414 | const struct GNUNET_HashCode * key, |
1414 | enum GNUNET_BLOCK_Type type, | 1415 | enum GNUNET_BLOCK_Type type, |
1415 | unsigned int queue_priority, | 1416 | unsigned int queue_priority, |
1416 | unsigned int max_queue_size, | 1417 | unsigned int max_queue_size, |
1417 | struct GNUNET_TIME_Relative timeout, | 1418 | struct GNUNET_TIME_Relative timeout, |
1418 | GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls) | 1419 | GNUNET_DATASTORE_DatumProcessor proc, |
1420 | void *proc_cls) | ||
1419 | { | 1421 | { |
1420 | struct GNUNET_DATASTORE_QueueEntry *qe; | 1422 | struct GNUNET_DATASTORE_QueueEntry *qe; |
1421 | struct GetMessage *gm; | 1423 | struct GetMessage *gm; |
@@ -1427,8 +1429,13 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset, | |||
1427 | (unsigned int) type, GNUNET_h2s (key)); | 1429 | (unsigned int) type, GNUNET_h2s (key)); |
1428 | qc.rc.proc = proc; | 1430 | qc.rc.proc = proc; |
1429 | qc.rc.proc_cls = proc_cls; | 1431 | qc.rc.proc_cls = proc_cls; |
1430 | qe = make_queue_entry (h, sizeof (struct GetMessage), queue_priority, | 1432 | qe = make_queue_entry (h, |
1431 | max_queue_size, timeout, &process_result_message, &qc); | 1433 | sizeof (struct GetMessage), |
1434 | queue_priority, | ||
1435 | max_queue_size, | ||
1436 | timeout, | ||
1437 | &process_result_message, | ||
1438 | &qc); | ||
1432 | if (qe == NULL) | 1439 | if (qe == NULL) |
1433 | { | 1440 | { |
1434 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Could not queue request for `%s'\n", | 1441 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Could not queue request for `%s'\n", |
@@ -1436,8 +1443,10 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset, | |||
1436 | return NULL; | 1443 | return NULL; |
1437 | } | 1444 | } |
1438 | #if INSANE_STATISTICS | 1445 | #if INSANE_STATISTICS |
1439 | GNUNET_STATISTICS_update (h->stats, gettext_noop ("# GET requests executed"), | 1446 | GNUNET_STATISTICS_update (h->stats, |
1440 | 1, GNUNET_NO); | 1447 | gettext_noop ("# GET requests executed"), |
1448 | 1, | ||
1449 | GNUNET_NO); | ||
1441 | #endif | 1450 | #endif |
1442 | gm = (struct GetMessage *) &qe[1]; | 1451 | gm = (struct GetMessage *) &qe[1]; |
1443 | gm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_GET); | 1452 | gm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_GET); |
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index 2f19e3d5d..0e68718ac 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c | |||
@@ -327,7 +327,8 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, | |||
327 | return GNUNET_SYSERR; | 327 | return GNUNET_SYSERR; |
328 | } | 328 | } |
329 | GNUNET_STATISTICS_update (GSF_stats, | 329 | GNUNET_STATISTICS_update (GSF_stats, |
330 | gettext_noop ("# client searches received"), 1, | 330 | gettext_noop ("# client searches received"), |
331 | 1, | ||
331 | GNUNET_NO); | 332 | GNUNET_NO); |
332 | sc = (msize - sizeof (struct SearchMessage)) / sizeof (struct GNUNET_HashCode); | 333 | sc = (msize - sizeof (struct SearchMessage)) / sizeof (struct GNUNET_HashCode); |
333 | sm = (const struct SearchMessage *) message; | 334 | sm = (const struct SearchMessage *) message; |
@@ -349,7 +350,9 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, | |||
349 | (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a | 350 | (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a |
350 | matching query and type */ | 351 | matching query and type */ |
351 | if ((GNUNET_YES != prd->has_started) && | 352 | if ((GNUNET_YES != prd->has_started) && |
352 | (0 != memcmp (&prd->query, &sm->query, sizeof (struct GNUNET_HashCode))) && | 353 | (0 != memcmp (&prd->query, |
354 | &sm->query, | ||
355 | sizeof (struct GNUNET_HashCode))) && | ||
353 | (prd->type == type)) | 356 | (prd->type == type)) |
354 | break; | 357 | break; |
355 | cr = cr->next; | 358 | cr = cr->next; |
@@ -359,7 +362,9 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, | |||
359 | { | 362 | { |
360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 363 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
361 | "Have existing request, merging content-seen lists.\n"); | 364 | "Have existing request, merging content-seen lists.\n"); |
362 | GSF_pending_request_update_ (cr->pr, (const struct GNUNET_HashCode *) &sm[1], sc); | 365 | GSF_pending_request_update_ (cr->pr, |
366 | (const struct GNUNET_HashCode *) &sm[1], | ||
367 | sc); | ||
363 | GNUNET_STATISTICS_update (GSF_stats, | 368 | GNUNET_STATISTICS_update (GSF_stats, |
364 | gettext_noop | 369 | gettext_noop |
365 | ("# client searches updated (merged content seen list)"), | 370 | ("# client searches updated (merged content seen list)"), |
@@ -372,7 +377,9 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, | |||
372 | GNUNET_NO); | 377 | GNUNET_NO); |
373 | cr = GNUNET_new (struct ClientRequest); | 378 | cr = GNUNET_new (struct ClientRequest); |
374 | cr->lc = lc; | 379 | cr->lc = lc; |
375 | GNUNET_CONTAINER_DLL_insert (lc->cr_head, lc->cr_tail, cr); | 380 | GNUNET_CONTAINER_DLL_insert (lc->cr_head, |
381 | lc->cr_tail, | ||
382 | cr); | ||
376 | options = GSF_PRO_LOCAL_REQUEST; | 383 | options = GSF_PRO_LOCAL_REQUEST; |
377 | if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options))) | 384 | if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options))) |
378 | options |= GSF_PRO_LOCAL_ONLY; | 385 | options |= GSF_PRO_LOCAL_ONLY; |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 709874f75..c1ef6891c 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -1275,11 +1275,13 @@ warn_delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1275 | { | 1275 | { |
1276 | struct GSF_PendingRequest *pr = cls; | 1276 | struct GSF_PendingRequest *pr = cls; |
1277 | 1277 | ||
1278 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1278 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, |
1279 | _("Datastore lookup already took %s!\n"), | 1279 | _("Datastore lookup already took %s!\n"), |
1280 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pr->qe_start), GNUNET_YES)); | 1280 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pr->qe_start), |
1281 | GNUNET_YES)); | ||
1281 | pr->warn_task = | 1282 | pr->warn_task = |
1282 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_delay_task, | 1283 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
1284 | &warn_delay_task, | ||
1283 | pr); | 1285 | pr); |
1284 | } | 1286 | } |
1285 | 1287 | ||
@@ -1514,10 +1516,10 @@ process_local_reply (void *cls, | |||
1514 | ((GNUNET_YES == GSF_test_get_load_too_high_ (0)) || | 1516 | ((GNUNET_YES == GSF_test_get_load_too_high_ (0)) || |
1515 | (pr->public_data.results_found > 5 + 2 * pr->public_data.priority))) | 1517 | (pr->public_data.results_found > 5 + 2 * pr->public_data.priority))) |
1516 | { | 1518 | { |
1517 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load too high, done with request\n"); | 1519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1520 | "Load too high, done with request\n"); | ||
1518 | GNUNET_STATISTICS_update (GSF_stats, | 1521 | GNUNET_STATISTICS_update (GSF_stats, |
1519 | gettext_noop | 1522 | gettext_noop ("# Datastore lookups concluded (load too high)"), |
1520 | ("# Datastore lookups concluded (load too high)"), | ||
1521 | 1, | 1523 | 1, |
1522 | GNUNET_NO); | 1524 | GNUNET_NO); |
1523 | goto check_error_and_continue; | 1525 | goto check_error_and_continue; |
@@ -1626,7 +1628,8 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, | |||
1626 | pr->llc_cont_cls = cont_cls; | 1628 | pr->llc_cont_cls = cont_cls; |
1627 | pr->qe_start = GNUNET_TIME_absolute_get (); | 1629 | pr->qe_start = GNUNET_TIME_absolute_get (); |
1628 | pr->warn_task = | 1630 | pr->warn_task = |
1629 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_delay_task, | 1631 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
1632 | &warn_delay_task, | ||
1630 | pr); | 1633 | pr); |
1631 | #if INSANE_STATISTICS | 1634 | #if INSANE_STATISTICS |
1632 | GNUNET_STATISTICS_update (GSF_stats, | 1635 | GNUNET_STATISTICS_update (GSF_stats, |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 4dc869fd2..08b8c24f0 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -200,7 +200,8 @@ handle_query_message (void *cls, | |||
200 | GNUNET_CRYPTO_hash (&qm->key, | 200 | GNUNET_CRYPTO_hash (&qm->key, |
201 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), | 201 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
202 | &hc); | 202 | &hc); |
203 | res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc); | 203 | res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, |
204 | &hc); | ||
204 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
205 | (GNUNET_NO == res) | 206 | (GNUNET_NO == res) |
206 | ? "Received revocation check for valid key `%s' from client\n" | 207 | ? "Received revocation check for valid key `%s' from client\n" |
@@ -215,7 +216,8 @@ handle_query_message (void *cls, | |||
215 | client, | 216 | client, |
216 | &qrm.header, | 217 | &qrm.header, |
217 | GNUNET_NO); | 218 | GNUNET_NO); |
218 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 219 | GNUNET_SERVER_receive_done (client, |
220 | GNUNET_OK); | ||
219 | } | 221 | } |
220 | 222 | ||
221 | 223 | ||
@@ -237,10 +239,14 @@ do_flood (void *cls, | |||
237 | struct GNUNET_MQ_Envelope *e; | 239 | struct GNUNET_MQ_Envelope *e; |
238 | struct RevokeMessage *cp; | 240 | struct RevokeMessage *cp; |
239 | 241 | ||
240 | e = GNUNET_MQ_msg (cp, GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); | 242 | e = GNUNET_MQ_msg (cp, |
243 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); | ||
241 | *cp = *rm; | 244 | *cp = *rm; |
242 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Flooding revocation to `%s'\n", GNUNET_i2s (target)); | 245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
243 | GNUNET_MQ_send (pe->mq, e); | 246 | "Flooding revocation to `%s'\n", |
247 | GNUNET_i2s (target)); | ||
248 | GNUNET_MQ_send (pe->mq, | ||
249 | e); | ||
244 | return GNUNET_OK; | 250 | return GNUNET_OK; |
245 | } | 251 | } |
246 | 252 | ||
@@ -309,7 +315,8 @@ publicize_rm (const struct RevokeMessage *rm) | |||
309 | if (GNUNET_OK != | 315 | if (GNUNET_OK != |
310 | GNUNET_SET_add_element (revocation_set, | 316 | GNUNET_SET_add_element (revocation_set, |
311 | &e, | 317 | &e, |
312 | NULL, NULL)) | 318 | NULL, |
319 | NULL)) | ||
313 | { | 320 | { |
314 | GNUNET_break (0); | 321 | GNUNET_break (0); |
315 | return GNUNET_OK; | 322 | return GNUNET_OK; |
@@ -349,7 +356,8 @@ handle_revoke_message (void *cls, | |||
349 | if (GNUNET_SYSERR == (ret = publicize_rm (rm))) | 356 | if (GNUNET_SYSERR == (ret = publicize_rm (rm))) |
350 | { | 357 | { |
351 | GNUNET_break_op (0); | 358 | GNUNET_break_op (0); |
352 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 359 | GNUNET_SERVER_receive_done (client, |
360 | GNUNET_SYSERR); | ||
353 | return; | 361 | return; |
354 | } | 362 | } |
355 | rrm.header.size = htons (sizeof (struct RevocationResponseMessage)); | 363 | rrm.header.size = htons (sizeof (struct RevocationResponseMessage)); |
@@ -361,7 +369,8 @@ handle_revoke_message (void *cls, | |||
361 | client, | 369 | client, |
362 | &rrm.header, | 370 | &rrm.header, |
363 | GNUNET_NO); | 371 | GNUNET_NO); |
364 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 372 | GNUNET_SERVER_receive_done (client, |
373 | GNUNET_OK); | ||
365 | } | 374 | } |
366 | 375 | ||
367 | 376 | ||
@@ -387,7 +396,6 @@ handle_p2p_revoke_message (void *cls, | |||
387 | } | 396 | } |
388 | 397 | ||
389 | 398 | ||
390 | |||
391 | /** | 399 | /** |
392 | * Callback for set operation results. Called for each element in the | 400 | * Callback for set operation results. Called for each element in the |
393 | * result set. Each element contains a revocation, which we should | 401 | * result set. Each element contains a revocation, which we should |
@@ -416,7 +424,7 @@ add_revocation (void *cls, | |||
416 | if (0 != element->element_type) | 424 | if (0 != element->element_type) |
417 | { | 425 | { |
418 | GNUNET_STATISTICS_update (stats, | 426 | GNUNET_STATISTICS_update (stats, |
419 | "# unsupported revocations received via set union", | 427 | gettext_noop ("# unsupported revocations received via set union"), |
420 | 1, GNUNET_NO); | 428 | 1, GNUNET_NO); |
421 | return; | 429 | return; |
422 | } | 430 | } |
@@ -425,7 +433,7 @@ add_revocation (void *cls, | |||
425 | &peer_entry->id, | 433 | &peer_entry->id, |
426 | &rm->header); | 434 | &rm->header); |
427 | GNUNET_STATISTICS_update (stats, | 435 | GNUNET_STATISTICS_update (stats, |
428 | "# revocation messages received via set union", | 436 | gettext_noop ("# revocation messages received via set union"), |
429 | 1, GNUNET_NO); | 437 | 1, GNUNET_NO); |
430 | break; | 438 | break; |
431 | case GNUNET_SET_STATUS_FAILURE: | 439 | case GNUNET_SET_STATUS_FAILURE: |
@@ -434,16 +442,18 @@ add_revocation (void *cls, | |||
434 | GNUNET_i2s (&peer_entry->id)); | 442 | GNUNET_i2s (&peer_entry->id)); |
435 | peer_entry->so = NULL; | 443 | peer_entry->so = NULL; |
436 | GNUNET_STATISTICS_update (stats, | 444 | GNUNET_STATISTICS_update (stats, |
437 | "# revocation set unions failed", | 445 | gettext_noop ("# revocation set unions failed"), |
438 | 1, GNUNET_NO); | 446 | 1, |
447 | GNUNET_NO); | ||
439 | break; | 448 | break; |
440 | case GNUNET_SET_STATUS_HALF_DONE: | 449 | case GNUNET_SET_STATUS_HALF_DONE: |
441 | break; | 450 | break; |
442 | case GNUNET_SET_STATUS_DONE: | 451 | case GNUNET_SET_STATUS_DONE: |
443 | peer_entry->so = NULL; | 452 | peer_entry->so = NULL; |
444 | GNUNET_STATISTICS_update (stats, | 453 | GNUNET_STATISTICS_update (stats, |
445 | "# revocation set unions completed", | 454 | gettext_noop ("# revocation set unions completed"), |
446 | 1, GNUNET_NO); | 455 | 1, |
456 | GNUNET_NO); | ||
447 | break; | 457 | break; |
448 | default: | 458 | default: |
449 | GNUNET_break (0); | 459 | GNUNET_break (0); |
@@ -502,7 +512,9 @@ handle_core_connect (void *cls, | |||
502 | struct GNUNET_HashCode my_hash; | 512 | struct GNUNET_HashCode my_hash; |
503 | struct GNUNET_HashCode peer_hash; | 513 | struct GNUNET_HashCode peer_hash; |
504 | 514 | ||
505 | if (0 == memcmp(peer, &my_identity, sizeof (my_identity))) | 515 | if (0 == memcmp(peer, |
516 | &my_identity, | ||
517 | sizeof (my_identity))) | ||
506 | return; | 518 | return; |
507 | 519 | ||
508 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 520 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -510,22 +522,21 @@ handle_core_connect (void *cls, | |||
510 | GNUNET_i2s (peer)); | 522 | GNUNET_i2s (peer)); |
511 | peer_entry = GNUNET_CONTAINER_multipeermap_get (peers, | 523 | peer_entry = GNUNET_CONTAINER_multipeermap_get (peers, |
512 | peer); | 524 | peer); |
513 | if (NULL == peer_entry) | 525 | GNUNET_assert (NULL == peer_entry); |
514 | { | 526 | peer_entry = GNUNET_new (struct PeerEntry); |
515 | peer_entry = GNUNET_new (struct PeerEntry); | 527 | peer_entry->id = *peer; |
516 | peer_entry->id = *peer; | 528 | GNUNET_assert (GNUNET_OK == |
517 | GNUNET_assert (GNUNET_OK == | 529 | GNUNET_CONTAINER_multipeermap_put (peers, |
518 | GNUNET_CONTAINER_multipeermap_put (peers, peer, | 530 | &peer_entry->id, |
519 | peer_entry, | 531 | peer_entry, |
520 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 532 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
521 | } | ||
522 | else | ||
523 | { | ||
524 | GNUNET_assert (NULL == peer_entry->mq); | ||
525 | } | ||
526 | peer_entry->mq = GNUNET_CORE_mq_create (core_api, peer); | 533 | peer_entry->mq = GNUNET_CORE_mq_create (core_api, peer); |
527 | GNUNET_CRYPTO_hash (&my_identity, sizeof (my_identity), &my_hash); | 534 | GNUNET_CRYPTO_hash (&my_identity, |
528 | GNUNET_CRYPTO_hash (peer, sizeof (*peer), &peer_hash); | 535 | sizeof (my_identity), |
536 | &my_hash); | ||
537 | GNUNET_CRYPTO_hash (peer, | ||
538 | sizeof (*peer), | ||
539 | &peer_hash); | ||
529 | if (0 < GNUNET_CRYPTO_hash_cmp (&my_hash, | 540 | if (0 < GNUNET_CRYPTO_hash_cmp (&my_hash, |
530 | &peer_hash)) | 541 | &peer_hash)) |
531 | { | 542 | { |
@@ -537,7 +548,10 @@ handle_core_connect (void *cls, | |||
537 | &transmit_task_cb, | 548 | &transmit_task_cb, |
538 | peer_entry); | 549 | peer_entry); |
539 | } | 550 | } |
540 | GNUNET_STATISTICS_update (stats, "# peers connected", 1, GNUNET_NO); | 551 | GNUNET_STATISTICS_update (stats, |
552 | "# peers connected", | ||
553 | 1, | ||
554 | GNUNET_NO); | ||
541 | } | 555 | } |
542 | 556 | ||
543 | 557 | ||
@@ -554,23 +568,23 @@ handle_core_disconnect (void *cls, | |||
554 | { | 568 | { |
555 | struct PeerEntry *pos; | 569 | struct PeerEntry *pos; |
556 | 570 | ||
557 | if (0 == memcmp(peer, &my_identity, sizeof (my_identity))) | 571 | if (0 == memcmp (peer, |
558 | return; | 572 | &my_identity, |
573 | sizeof (my_identity))) | ||
574 | return; | ||
559 | 575 | ||
560 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
561 | "Peer `%s' disconnected from us\n", | 577 | "Peer `%s' disconnected from us\n", |
562 | GNUNET_i2s (peer)); | 578 | GNUNET_i2s (peer)); |
563 | pos = GNUNET_CONTAINER_multipeermap_get (peers, peer); | 579 | pos = GNUNET_CONTAINER_multipeermap_get (peers, |
564 | if (NULL == pos) | 580 | peer); |
565 | { | 581 | GNUNET_assert (NULL != pos); |
566 | GNUNET_break (0); | ||
567 | return; | ||
568 | } | ||
569 | GNUNET_assert (GNUNET_YES == | 582 | GNUNET_assert (GNUNET_YES == |
570 | GNUNET_CONTAINER_multipeermap_remove (peers, peer, | 583 | GNUNET_CONTAINER_multipeermap_remove (peers, |
584 | peer, | ||
571 | pos)); | 585 | pos)); |
572 | GNUNET_MQ_destroy (pos->mq); | 586 | GNUNET_MQ_destroy (pos->mq); |
573 | if (pos->transmit_task != NULL) | 587 | if (NULL != pos->transmit_task) |
574 | { | 588 | { |
575 | GNUNET_SCHEDULER_cancel (pos->transmit_task); | 589 | GNUNET_SCHEDULER_cancel (pos->transmit_task); |
576 | pos->transmit_task = NULL; | 590 | pos->transmit_task = NULL; |
@@ -581,7 +595,10 @@ handle_core_disconnect (void *cls, | |||
581 | pos->so = NULL; | 595 | pos->so = NULL; |
582 | } | 596 | } |
583 | GNUNET_free (pos); | 597 | GNUNET_free (pos); |
584 | GNUNET_STATISTICS_update (stats, "# peers connected", -1, GNUNET_NO); | 598 | GNUNET_STATISTICS_update (stats, |
599 | "# peers connected", | ||
600 | -1, | ||
601 | GNUNET_NO); | ||
585 | } | 602 | } |
586 | 603 | ||
587 | 604 | ||
@@ -855,9 +872,11 @@ run (void *cls, | |||
855 | } | 872 | } |
856 | GNUNET_free (fn); | 873 | GNUNET_free (fn); |
857 | 874 | ||
858 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | 875 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
876 | &shutdown_task, | ||
859 | NULL); | 877 | NULL); |
860 | peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 878 | peers = GNUNET_CONTAINER_multipeermap_create (128, |
879 | GNUNET_YES); | ||
861 | GNUNET_SERVER_add_handlers (srv, handlers); | 880 | GNUNET_SERVER_add_handlers (srv, handlers); |
862 | /* Connect to core service and register core handlers */ | 881 | /* Connect to core service and register core handlers */ |
863 | core_api = GNUNET_CORE_connect (cfg, /* Main configuration */ | 882 | core_api = GNUNET_CORE_connect (cfg, /* Main configuration */ |
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index 5696f632c..2ca57ab6d 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.c | |||
@@ -234,8 +234,7 @@ struct SetState | |||
234 | * @param cls closure | 234 | * @param cls closure |
235 | * @param key current key code | 235 | * @param key current key code |
236 | * @param value value in the hash map | 236 | * @param value value in the hash map |
237 | * @return #GNUNET_YES if we should continue to | 237 | * @return #GNUNET_YES if we should continue to iterate, |
238 | * iterate, | ||
239 | * #GNUNET_NO if not. | 238 | * #GNUNET_NO if not. |
240 | */ | 239 | */ |
241 | static int | 240 | static int |
@@ -546,6 +545,7 @@ prepare_ibf (struct Operation *op, | |||
546 | if (NULL == op->state->key_to_element) | 545 | if (NULL == op->state->key_to_element) |
547 | { | 546 | { |
548 | unsigned int len; | 547 | unsigned int len; |
548 | |||
549 | len = GNUNET_CONTAINER_multihashmap_size (op->spec->set->elements); | 549 | len = GNUNET_CONTAINER_multihashmap_size (op->spec->set->elements); |
550 | op->state->key_to_element = GNUNET_CONTAINER_multihashmap32_create (len + 1); | 550 | op->state->key_to_element = GNUNET_CONTAINER_multihashmap32_create (len + 1); |
551 | GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->elements, | 551 | GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->elements, |
@@ -592,8 +592,9 @@ send_ibf (struct Operation *op, | |||
592 | if (buckets_in_message > MAX_BUCKETS_PER_MESSAGE) | 592 | if (buckets_in_message > MAX_BUCKETS_PER_MESSAGE) |
593 | buckets_in_message = MAX_BUCKETS_PER_MESSAGE; | 593 | buckets_in_message = MAX_BUCKETS_PER_MESSAGE; |
594 | 594 | ||
595 | ev = GNUNET_MQ_msg_extra (msg, buckets_in_message * IBF_BUCKET_SIZE, | 595 | ev = GNUNET_MQ_msg_extra (msg, |
596 | GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF); | 596 | buckets_in_message * IBF_BUCKET_SIZE, |
597 | GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF); | ||
597 | msg->reserved = 0; | 598 | msg->reserved = 0; |
598 | msg->order = ibf_order; | 599 | msg->order = ibf_order; |
599 | msg->offset = htons (buckets_sent); | 600 | msg->offset = htons (buckets_sent); |
@@ -627,7 +628,8 @@ send_strata_estimator (struct Operation *op) | |||
627 | SE_STRATA_COUNT * IBF_BUCKET_SIZE * SE_IBF_SIZE, | 628 | SE_STRATA_COUNT * IBF_BUCKET_SIZE * SE_IBF_SIZE, |
628 | GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE); | 629 | GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE); |
629 | strata_estimator_write (op->state->se, &strata_msg[1]); | 630 | strata_estimator_write (op->state->se, &strata_msg[1]); |
630 | GNUNET_MQ_send (op->mq, ev); | 631 | GNUNET_MQ_send (op->mq, |
632 | ev); | ||
631 | op->state->phase = PHASE_EXPECT_IBF; | 633 | op->state->phase = PHASE_EXPECT_IBF; |
632 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 634 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
633 | "sent SE, expecting IBF\n"); | 635 | "sent SE, expecting IBF\n"); |
@@ -1065,13 +1067,15 @@ send_remaining_elements (void *cls) | |||
1065 | struct GNUNET_MQ_Envelope *ev; | 1067 | struct GNUNET_MQ_Envelope *ev; |
1066 | struct GNUNET_SET_ResultMessage *rm; | 1068 | struct GNUNET_SET_ResultMessage *rm; |
1067 | struct GNUNET_SET_Element *element; | 1069 | struct GNUNET_SET_Element *element; |
1068 | element = &ke->element->element; | ||
1069 | 1070 | ||
1071 | element = &ke->element->element; | ||
1070 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1072 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1071 | "sending element (size %u) to client (full set)\n", | 1073 | "sending element (size %u) to client (full set)\n", |
1072 | element->size); | 1074 | element->size); |
1073 | GNUNET_assert (0 != op->spec->client_request_id); | 1075 | GNUNET_assert (0 != op->spec->client_request_id); |
1074 | ev = GNUNET_MQ_msg_extra (rm, element->size, GNUNET_MESSAGE_TYPE_SET_RESULT); | 1076 | ev = GNUNET_MQ_msg_extra (rm, |
1077 | element->size, | ||
1078 | GNUNET_MESSAGE_TYPE_SET_RESULT); | ||
1075 | if (NULL == ev) | 1079 | if (NULL == ev) |
1076 | { | 1080 | { |
1077 | GNUNET_MQ_discard (ev); | 1081 | GNUNET_MQ_discard (ev); |
@@ -1280,7 +1284,8 @@ union_evaluate (struct Operation *op, | |||
1280 | } | 1284 | } |
1281 | msg->operation = htonl (GNUNET_SET_OPERATION_UNION); | 1285 | msg->operation = htonl (GNUNET_SET_OPERATION_UNION); |
1282 | msg->app_id = op->spec->app_id; | 1286 | msg->app_id = op->spec->app_id; |
1283 | GNUNET_MQ_send (op->mq, ev); | 1287 | GNUNET_MQ_send (op->mq, |
1288 | ev); | ||
1284 | 1289 | ||
1285 | if (NULL != opaque_context) | 1290 | if (NULL != opaque_context) |
1286 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1429,14 +1434,17 @@ union_peer_disconnect (struct Operation *op) | |||
1429 | struct GNUNET_MQ_Envelope *ev; | 1434 | struct GNUNET_MQ_Envelope *ev; |
1430 | struct GNUNET_SET_ResultMessage *msg; | 1435 | struct GNUNET_SET_ResultMessage *msg; |
1431 | 1436 | ||
1432 | ev = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_RESULT); | 1437 | ev = GNUNET_MQ_msg (msg, |
1438 | GNUNET_MESSAGE_TYPE_SET_RESULT); | ||
1433 | msg->request_id = htonl (op->spec->client_request_id); | 1439 | msg->request_id = htonl (op->spec->client_request_id); |
1434 | msg->result_status = htons (GNUNET_SET_STATUS_FAILURE); | 1440 | msg->result_status = htons (GNUNET_SET_STATUS_FAILURE); |
1435 | msg->element_type = htons (0); | 1441 | msg->element_type = htons (0); |
1436 | GNUNET_MQ_send (op->spec->set->client_mq, ev); | 1442 | GNUNET_MQ_send (op->spec->set->client_mq, |
1443 | ev); | ||
1437 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1444 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1438 | "other peer disconnected prematurely\n"); | 1445 | "other peer disconnected prematurely\n"); |
1439 | _GSS_operation_destroy (op, GNUNET_YES); | 1446 | _GSS_operation_destroy (op, |
1447 | GNUNET_YES); | ||
1440 | return; | 1448 | return; |
1441 | } | 1449 | } |
1442 | // else: the session has already been concluded | 1450 | // else: the session has already been concluded |
diff --git a/src/set/set_api.c b/src/set/set_api.c index 390d35e5f..ad46fe9db 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c | |||
@@ -324,7 +324,8 @@ handle_result (void *cls, | |||
324 | { | 324 | { |
325 | /* status is not #GNUNET_SET_STATUS_OK => there's no attached element, | 325 | /* status is not #GNUNET_SET_STATUS_OK => there's no attached element, |
326 | * and this is the last result message we get */ | 326 | * and this is the last result message we get */ |
327 | GNUNET_MQ_assoc_remove (set->mq, ntohl (msg->request_id)); | 327 | GNUNET_MQ_assoc_remove (set->mq, |
328 | ntohl (msg->request_id)); | ||
328 | GNUNET_CONTAINER_DLL_remove (set->ops_head, | 329 | GNUNET_CONTAINER_DLL_remove (set->ops_head, |
329 | set->ops_tail, | 330 | set->ops_tail, |
330 | oh); | 331 | oh); |