diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-27 12:36:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-27 12:36:00 +0000 |
commit | a150300aa185d88e3bf7fa637b81d04d130896a5 (patch) | |
tree | c2fe952608453ac95bff7ae64afbbf36c02eef05 /src/dht/gnunet-service-dht_neighbours.c | |
parent | 62228e9e0beb7e96812fd24b72d85184f87b8471 (diff) | |
download | gnunet-a150300aa185d88e3bf7fa637b81d04d130896a5.tar.gz gnunet-a150300aa185d88e3bf7fa637b81d04d130896a5.zip |
-do not crash if disable_try_connect is set
Diffstat (limited to 'src/dht/gnunet-service-dht_neighbours.c')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 7b1efff1f..4add3c4ae 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -719,12 +719,14 @@ send_find_peer_message (void *cls) | |||
719 | /* If we are finding many peers already, no need to send out our request right now! */ | 719 | /* If we are finding many peers already, no need to send out our request right now! */ |
720 | find_peer_task = | 720 | find_peer_task = |
721 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, | 721 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
722 | &send_find_peer_message, NULL); | 722 | &send_find_peer_message, |
723 | NULL); | ||
723 | newly_found_peers = 0; | 724 | newly_found_peers = 0; |
724 | return; | 725 | return; |
725 | } | 726 | } |
726 | bcc.bf_mutator = | 727 | bcc.bf_mutator = |
727 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX); | 728 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
729 | UINT32_MAX); | ||
728 | bcc.bloom = | 730 | bcc.bloom = |
729 | GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, | 731 | GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, |
730 | GNUNET_CONSTANTS_BLOOMFILTER_K); | 732 | GNUNET_CONSTANTS_BLOOMFILTER_K); |
@@ -732,7 +734,8 @@ send_find_peer_message (void *cls) | |||
732 | &add_known_to_bloom, | 734 | &add_known_to_bloom, |
733 | &bcc); | 735 | &bcc); |
734 | GNUNET_STATISTICS_update (GDS_stats, | 736 | GNUNET_STATISTICS_update (GDS_stats, |
735 | gettext_noop ("# FIND PEER messages initiated"), 1, | 737 | gettext_noop ("# FIND PEER messages initiated"), |
738 | 1, | ||
736 | GNUNET_NO); | 739 | GNUNET_NO); |
737 | peer_bf = | 740 | peer_bf = |
738 | GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, | 741 | GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, |
@@ -819,8 +822,8 @@ handle_core_connect (void *cls, | |||
819 | update_connect_preferences (); | 822 | update_connect_preferences (); |
820 | newly_found_peers++; | 823 | newly_found_peers++; |
821 | } | 824 | } |
822 | if (1 == GNUNET_CONTAINER_multipeermap_size (all_connected_peers) && | 825 | if ( (1 == GNUNET_CONTAINER_multipeermap_size (all_connected_peers)) && |
823 | (GNUNET_YES != disable_try_connect)) | 826 | (GNUNET_YES != disable_try_connect)) |
824 | { | 827 | { |
825 | /* got a first connection, good time to start with FIND PEER requests... */ | 828 | /* got a first connection, good time to start with FIND PEER requests... */ |
826 | GNUNET_assert (NULL == find_peer_task); | 829 | GNUNET_assert (NULL == find_peer_task); |
@@ -870,7 +873,8 @@ handle_core_disconnect (void *cls, | |||
870 | GNUNET_CONTAINER_multipeermap_remove (all_connected_peers, | 873 | GNUNET_CONTAINER_multipeermap_remove (all_connected_peers, |
871 | peer, | 874 | peer, |
872 | to_remove)); | 875 | to_remove)); |
873 | if (0 == GNUNET_CONTAINER_multipeermap_size (all_connected_peers)) | 876 | if ( (0 == GNUNET_CONTAINER_multipeermap_size (all_connected_peers) && |
877 | (GNUNET_YES != disable_try_connect)) ) | ||
874 | { | 878 | { |
875 | GNUNET_SCHEDULER_cancel (find_peer_task); | 879 | GNUNET_SCHEDULER_cancel (find_peer_task); |
876 | find_peer_task = NULL; | 880 | find_peer_task = NULL; |
@@ -2522,11 +2526,7 @@ GDS_NEIGHBOURS_done () | |||
2522 | all_desired_peers = NULL; | 2526 | all_desired_peers = NULL; |
2523 | GNUNET_ATS_connectivity_done (ats_ch); | 2527 | GNUNET_ATS_connectivity_done (ats_ch); |
2524 | ats_ch = NULL; | 2528 | ats_ch = NULL; |
2525 | if (NULL != find_peer_task) | 2529 | GNUNET_assert (NULL == find_peer_task); |
2526 | { | ||
2527 | GNUNET_SCHEDULER_cancel (find_peer_task); | ||
2528 | find_peer_task = NULL; | ||
2529 | } | ||
2530 | } | 2530 | } |
2531 | 2531 | ||
2532 | 2532 | ||