diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-10-06 09:47:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-10-06 09:47:05 +0000 |
commit | a66550732703fa7e88bc86b042e73c0add3e91a0 (patch) | |
tree | 1d048880afa5c502e8d5ae6ae4d68ea144615738 /src | |
parent | 5ed9232335bafe224acccde336587940a8c6366c (diff) | |
download | gnunet-a66550732703fa7e88bc86b042e73c0add3e91a0.tar.gz gnunet-a66550732703fa7e88bc86b042e73c0add3e91a0.zip |
code cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/gnunet-dht-driver.c | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c index 81ca94f17..4d129b7da 100644 --- a/src/dht/gnunet-dht-driver.c +++ b/src/dht/gnunet-dht-driver.c | |||
@@ -698,8 +698,9 @@ free_meter(struct ProgressMeter *meter) | |||
698 | /** | 698 | /** |
699 | * Check whether peers successfully shut down. | 699 | * Check whether peers successfully shut down. |
700 | */ | 700 | */ |
701 | void shutdown_callback (void *cls, | 701 | static void |
702 | const char *emsg) | 702 | shutdown_callback (void *cls, |
703 | const char *emsg) | ||
703 | { | 704 | { |
704 | if (emsg != NULL) | 705 | if (emsg != NULL) |
705 | { | 706 | { |
@@ -780,12 +781,13 @@ finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
780 | /** | 781 | /** |
781 | * Callback for iterating over all the peer connections of a peer group. | 782 | * Callback for iterating over all the peer connections of a peer group. |
782 | */ | 783 | */ |
783 | void log_topology_cb (void *cls, | 784 | static void |
784 | const struct GNUNET_PeerIdentity *first, | 785 | log_topology_cb (void *cls, |
785 | const struct GNUNET_PeerIdentity *second, | 786 | const struct GNUNET_PeerIdentity *first, |
786 | struct GNUNET_TIME_Relative latency, | 787 | const struct GNUNET_PeerIdentity *second, |
787 | uint32_t distance, | 788 | struct GNUNET_TIME_Relative latency, |
788 | const char *emsg) | 789 | uint32_t distance, |
790 | const char *emsg) | ||
789 | { | 791 | { |
790 | struct TopologyIteratorContext *topo_ctx = cls; | 792 | struct TopologyIteratorContext *topo_ctx = cls; |
791 | if ((first != NULL) && (second != NULL)) | 793 | if ((first != NULL) && (second != NULL)) |
@@ -840,7 +842,8 @@ static int stats_iterate (void *cls, | |||
840 | return GNUNET_YES; | 842 | return GNUNET_YES; |
841 | } | 843 | } |
842 | 844 | ||
843 | static void stats_finished (void *cls, int result) | 845 | static void |
846 | stats_finished (void *cls, int result) | ||
844 | { | 847 | { |
845 | fprintf(stderr, "Finished getting all peers statistics, iterating!\n"); | 848 | fprintf(stderr, "Finished getting all peers statistics, iterating!\n"); |
846 | GNUNET_CONTAINER_multihashmap_iterate(stats_map, &stats_iterate, NULL); | 849 | GNUNET_CONTAINER_multihashmap_iterate(stats_map, &stats_iterate, NULL); |
@@ -1206,12 +1209,13 @@ schedule_churn_find_peer_requests (void *cls, const struct GNUNET_SCHEDULER_Task | |||
1206 | * Used after we have churned on some peers to find which ones have zero | 1209 | * Used after we have churned on some peers to find which ones have zero |
1207 | * connections so we can make them issue find peer requests. | 1210 | * connections so we can make them issue find peer requests. |
1208 | */ | 1211 | */ |
1209 | void count_peers_churn_cb (void *cls, | 1212 | static void |
1210 | const struct GNUNET_PeerIdentity *first, | 1213 | count_peers_churn_cb (void *cls, |
1211 | const struct GNUNET_PeerIdentity *second, | 1214 | const struct GNUNET_PeerIdentity *first, |
1212 | struct GNUNET_TIME_Relative latency, | 1215 | const struct GNUNET_PeerIdentity *second, |
1213 | uint32_t distance, | 1216 | struct GNUNET_TIME_Relative latency, |
1214 | const char *emsg) | 1217 | uint32_t distance, |
1218 | const char *emsg) | ||
1215 | { | 1219 | { |
1216 | struct FindPeerContext *find_peer_context = cls; | 1220 | struct FindPeerContext *find_peer_context = cls; |
1217 | struct TopologyIteratorContext *topo_ctx; | 1221 | struct TopologyIteratorContext *topo_ctx; |
@@ -1812,7 +1816,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
1812 | 1816 | ||
1813 | for (i = 0; i < sizeof(data); i++) | 1817 | for (i = 0; i < sizeof(data); i++) |
1814 | { | 1818 | { |
1815 | memset(&data[i], GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t)-1), 1); | 1819 | memset(&data[i], GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX), 1); |
1816 | } | 1820 | } |
1817 | 1821 | ||
1818 | if (outstanding_puts > max_outstanding_puts) | 1822 | if (outstanding_puts > max_outstanding_puts) |
@@ -1871,12 +1875,13 @@ static unsigned int connection_estimate(unsigned int peer_count, unsigned int bu | |||
1871 | /** | 1875 | /** |
1872 | * Callback for iterating over all the peer connections of a peer group. | 1876 | * Callback for iterating over all the peer connections of a peer group. |
1873 | */ | 1877 | */ |
1874 | void count_peers_cb (void *cls, | 1878 | static void |
1875 | const struct GNUNET_PeerIdentity *first, | 1879 | count_peers_cb (void *cls, |
1876 | const struct GNUNET_PeerIdentity *second, | 1880 | const struct GNUNET_PeerIdentity *first, |
1877 | struct GNUNET_TIME_Relative latency, | 1881 | const struct GNUNET_PeerIdentity *second, |
1878 | uint32_t distance, | 1882 | struct GNUNET_TIME_Relative latency, |
1879 | const char *emsg) | 1883 | uint32_t distance, |
1884 | const char *emsg) | ||
1880 | { | 1885 | { |
1881 | struct FindPeerContext *find_peer_context = cls; | 1886 | struct FindPeerContext *find_peer_context = cls; |
1882 | if ((first != NULL) && (second != NULL)) | 1887 | if ((first != NULL) && (second != NULL)) |
@@ -2260,7 +2265,7 @@ setup_malicious_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc | |||
2260 | * The emsg variable is NULL on success (peers connected), and non-NULL on | 2265 | * The emsg variable is NULL on success (peers connected), and non-NULL on |
2261 | * failure (peers failed to connect). | 2266 | * failure (peers failed to connect). |
2262 | */ | 2267 | */ |
2263 | void | 2268 | static void |
2264 | topology_callback (void *cls, | 2269 | topology_callback (void *cls, |
2265 | const struct GNUNET_PeerIdentity *first, | 2270 | const struct GNUNET_PeerIdentity *first, |
2266 | const struct GNUNET_PeerIdentity *second, | 2271 | const struct GNUNET_PeerIdentity *second, |
@@ -2363,7 +2368,7 @@ peers_started_callback (void *cls, | |||
2363 | #endif | 2368 | #endif |
2364 | GNUNET_SCHEDULER_cancel (sched, die_task); | 2369 | GNUNET_SCHEDULER_cancel (sched, die_task); |
2365 | 2370 | ||
2366 | expected_connections = -1; | 2371 | expected_connections = UINT_MAX; |
2367 | if ((pg != NULL) && (peers_left == 0)) | 2372 | if ((pg != NULL) && (peers_left == 0)) |
2368 | { | 2373 | { |
2369 | expected_connections = GNUNET_TESTING_connect_topology (pg, connect_topology, connect_topology_option, connect_topology_option_modifier); | 2374 | expected_connections = GNUNET_TESTING_connect_topology (pg, connect_topology, connect_topology_option, connect_topology_option_modifier); |
@@ -2419,10 +2424,11 @@ create_topology () | |||
2419 | * @param d the daemon handle (pretty useless at this point, remove?) | 2424 | * @param d the daemon handle (pretty useless at this point, remove?) |
2420 | * @param emsg non-null on failure | 2425 | * @param emsg non-null on failure |
2421 | */ | 2426 | */ |
2422 | void hostkey_callback (void *cls, | 2427 | static void |
2423 | const struct GNUNET_PeerIdentity *id, | 2428 | hostkey_callback (void *cls, |
2424 | struct GNUNET_TESTING_Daemon *d, | 2429 | const struct GNUNET_PeerIdentity *id, |
2425 | const char *emsg) | 2430 | struct GNUNET_TESTING_Daemon *d, |
2431 | const char *emsg) | ||
2426 | { | 2432 | { |
2427 | if (emsg != NULL) | 2433 | if (emsg != NULL) |
2428 | { | 2434 | { |
@@ -2959,7 +2965,7 @@ run (void *cls, | |||
2959 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 2965 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
2960 | "Number of peers must be specified in section %s option %s\n", topology_str, "TESTING", "NUM_PEERS"); | 2966 | "Number of peers must be specified in section %s option %s\n", topology_str, "TESTING", "NUM_PEERS"); |
2961 | } | 2967 | } |
2962 | GNUNET_assert(num_peers > 0 && num_peers < (unsigned long long)-1); | 2968 | GNUNET_assert(num_peers > 0 && num_peers < ULONG_MAX); |
2963 | /* Set peers_left so we know when all peers started */ | 2969 | /* Set peers_left so we know when all peers started */ |
2964 | peers_left = num_peers; | 2970 | peers_left = num_peers; |
2965 | 2971 | ||