diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-27 08:59:35 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-27 08:59:35 +0000 |
commit | 37defe2dbd9ea4e5a37710404e8046acbdf4a18e (patch) | |
tree | 566829ee0f1614e969a7995c5e64a62014e98243 | |
parent | 1348e776ffe5315f19f395b990721198315c54ee (diff) | |
download | gnunet-37defe2dbd9ea4e5a37710404e8046acbdf4a18e.tar.gz gnunet-37defe2dbd9ea4e5a37710404e8046acbdf4a18e.zip |
- FIX: GNUNET_SET_STATUS_HALF_DONE is never called only GNUNET_SET_STATUS_DONE
- FIX: Crash since neighbor_table == NULL on removal check
-rw-r--r-- | src/dv/gnunet-service-dv.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 1eaaf9774..84bdc11c2 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -1409,6 +1409,9 @@ handle_set_union_result (void *cls, | |||
1409 | } | 1409 | } |
1410 | target = GNUNET_new (struct Target); | 1410 | target = GNUNET_new (struct Target); |
1411 | memcpy (target, element->data, sizeof (struct Target)); | 1411 | memcpy (target, element->data, sizeof (struct Target)); |
1412 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1413 | "Received information about peer `%s' with distance %u\n", | ||
1414 | GNUNET_i2s (&target->peer), ntohl(target->distance)); | ||
1412 | if (NULL == neighbor->neighbor_table_consensus) | 1415 | if (NULL == neighbor->neighbor_table_consensus) |
1413 | neighbor->neighbor_table_consensus = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); | 1416 | neighbor->neighbor_table_consensus = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
1414 | if (GNUNET_YES != | 1417 | if (GNUNET_YES != |
@@ -1442,36 +1445,38 @@ handle_set_union_result (void *cls, | |||
1442 | neighbor); | 1445 | neighbor); |
1443 | break; | 1446 | break; |
1444 | case GNUNET_SET_STATUS_HALF_DONE: | 1447 | case GNUNET_SET_STATUS_HALF_DONE: |
1448 | break; | ||
1449 | case GNUNET_SET_STATUS_DONE: | ||
1445 | /* we got all of our updates; integrate routing table! */ | 1450 | /* we got all of our updates; integrate routing table! */ |
1446 | neighbor->target_removed = GNUNET_NO; | 1451 | neighbor->target_removed = GNUNET_NO; |
1447 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, | 1452 | if (NULL == neighbor->neighbor_table_consensus) |
1448 | &check_target_removed, | 1453 | neighbor->neighbor_table_consensus = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
1449 | neighbor); | 1454 | if (NULL != neighbor->neighbor_table) |
1455 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, | ||
1456 | &check_target_removed, | ||
1457 | neighbor); | ||
1450 | if (GNUNET_YES == neighbor->target_removed) | 1458 | if (GNUNET_YES == neighbor->target_removed) |
1451 | { | 1459 | { |
1452 | /* check if we got an alternative for the removed routes */ | 1460 | /* check if we got an alternative for the removed routes */ |
1453 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, | 1461 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, |
1454 | &refresh_routes, | 1462 | &refresh_routes, |
1455 | NULL); | 1463 | NULL); |
1456 | } | 1464 | } |
1457 | /* add targets that appeared (and check for improved routes) */ | 1465 | /* add targets that appeared (and check for improved routes) */ |
1458 | if (NULL == neighbor->neighbor_table_consensus) | ||
1459 | neighbor->neighbor_table_consensus = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); | ||
1460 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus, | 1466 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus, |
1461 | &check_target_added, | 1467 | &check_target_added, |
1462 | neighbor); | 1468 | neighbor); |
1463 | if (NULL != neighbor->neighbor_table) | 1469 | if (NULL != neighbor->neighbor_table) |
1464 | { | 1470 | { |
1465 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, | 1471 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, |
1466 | &free_targets, | 1472 | &free_targets, |
1467 | NULL); | 1473 | NULL); |
1468 | GNUNET_CONTAINER_multipeermap_destroy (neighbor->neighbor_table); | 1474 | GNUNET_CONTAINER_multipeermap_destroy (neighbor->neighbor_table); |
1469 | neighbor->neighbor_table = NULL; | 1475 | neighbor->neighbor_table = NULL; |
1470 | } | 1476 | } |
1471 | neighbor->neighbor_table = neighbor->neighbor_table_consensus; | 1477 | neighbor->neighbor_table = neighbor->neighbor_table_consensus; |
1472 | neighbor->neighbor_table_consensus = NULL; | 1478 | neighbor->neighbor_table_consensus = NULL; |
1473 | break; | 1479 | |
1474 | case GNUNET_SET_STATUS_DONE: | ||
1475 | /* operation done, schedule next run! */ | 1480 | /* operation done, schedule next run! */ |
1476 | neighbor->set_op = NULL; | 1481 | neighbor->set_op = NULL; |
1477 | if (0 < memcmp (&neighbor->peer, | 1482 | if (0 < memcmp (&neighbor->peer, |