diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-22 14:53:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-22 14:53:11 +0100 |
commit | 0244c0d86cd86e4cc90e0c112c6edeafdfb558c2 (patch) | |
tree | b534b32562883064a09d856f700995a2f1b5cc42 /src/dht | |
parent | 7184623654f81c1ba557f8fa95a3086342b4af6b (diff) | |
download | gnunet-0244c0d86cd86e4cc90e0c112c6edeafdfb558c2.tar.gz gnunet-0244c0d86cd86e4cc90e0c112c6edeafdfb558c2.zip |
strcmp instead of memcmp
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/dht_api.c | 21 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 32 | ||||
-rw-r--r-- | src/dht/plugin_block_dht.c | 10 |
3 files changed, 48 insertions, 15 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index 070d248ed..ee208b50e 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -754,12 +754,25 @@ process_client_result (void *cls, | |||
754 | meta_length = | 754 | meta_length = |
755 | sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); | 755 | sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length); |
756 | data_length = msize - meta_length; | 756 | data_length = msize - meta_length; |
757 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
758 | "Giving %u byte reply for %s to application\n", | ||
759 | (unsigned int) data_length, | ||
760 | GNUNET_h2s (key)); | ||
761 | put_path = (const struct GNUNET_PeerIdentity *) &crm[1]; | 757 | put_path = (const struct GNUNET_PeerIdentity *) &crm[1]; |
762 | get_path = &put_path[put_path_length]; | 758 | get_path = &put_path[put_path_length]; |
759 | { | ||
760 | char *pp; | ||
761 | char *gp; | ||
762 | |||
763 | gp = GNUNET_STRINGS_pp2s (get_path, | ||
764 | get_path_length); | ||
765 | pp = GNUNET_STRINGS_pp2s (put_path, | ||
766 | put_path_length); | ||
767 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
768 | "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n", | ||
769 | (unsigned int) data_length, | ||
770 | GNUNET_h2s (key), | ||
771 | gp, | ||
772 | pp); | ||
773 | GNUNET_free (gp); | ||
774 | GNUNET_free (pp); | ||
775 | } | ||
763 | data = &get_path[get_path_length]; | 776 | data = &get_path[get_path_length]; |
764 | /* remember that we've seen this result */ | 777 | /* remember that we've seen this result */ |
765 | GNUNET_CRYPTO_hash (data, | 778 | GNUNET_CRYPTO_hash (data, |
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 346925032..bb6285730 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1665,10 +1665,13 @@ handle_dht_p2p_put (void *cls, | |||
1665 | if (GNUNET_YES == log_route_details_stderr) | 1665 | if (GNUNET_YES == log_route_details_stderr) |
1666 | { | 1666 | { |
1667 | char *tmp; | 1667 | char *tmp; |
1668 | char *pp; | ||
1668 | 1669 | ||
1670 | pp = GNUNET_STRINGS_pp2s (put_path, | ||
1671 | putlen); | ||
1669 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); | 1672 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); |
1670 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, | 1673 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, |
1671 | "R5N PUT %s: %s->%s (%u, %u=>%u)\n", | 1674 | "R5N PUT %s: %s->%s (%u, %u=>%u, PP: %s)\n", |
1672 | GNUNET_h2s (&put->key), | 1675 | GNUNET_h2s (&put->key), |
1673 | GNUNET_i2s (peer->id), | 1676 | GNUNET_i2s (peer->id), |
1674 | tmp, | 1677 | tmp, |
@@ -1676,8 +1679,9 @@ handle_dht_p2p_put (void *cls, | |||
1676 | GNUNET_CRYPTO_hash_matching_bits (&peer->phash, | 1679 | GNUNET_CRYPTO_hash_matching_bits (&peer->phash, |
1677 | &put->key), | 1680 | &put->key), |
1678 | GNUNET_CRYPTO_hash_matching_bits (&my_identity_hash, | 1681 | GNUNET_CRYPTO_hash_matching_bits (&my_identity_hash, |
1679 | &put->key) | 1682 | &put->key), |
1680 | ); | 1683 | pp); |
1684 | GNUNET_free (pp); | ||
1681 | GNUNET_free (tmp); | 1685 | GNUNET_free (tmp); |
1682 | } | 1686 | } |
1683 | switch (GNUNET_BLOCK_get_key | 1687 | switch (GNUNET_BLOCK_get_key |
@@ -1965,6 +1969,15 @@ handle_local_result (void *cls, | |||
1965 | const void *data, | 1969 | const void *data, |
1966 | size_t data_size) | 1970 | size_t data_size) |
1967 | { | 1971 | { |
1972 | char *pp; | ||
1973 | |||
1974 | pp = GNUNET_STRINGS_pp2s (put_path, | ||
1975 | put_path_length); | ||
1976 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1977 | "Found local result for %s (PP: %s)\n", | ||
1978 | GNUNET_h2s (key), | ||
1979 | pp); | ||
1980 | GNUNET_free (pp); | ||
1968 | // FIXME: we can probably do better here by | 1981 | // FIXME: we can probably do better here by |
1969 | // passing the peer that did the query in the closure... | 1982 | // passing the peer that did the query in the closure... |
1970 | GDS_ROUTING_process (NULL, | 1983 | GDS_ROUTING_process (NULL, |
@@ -2243,14 +2256,23 @@ handle_dht_p2p_result (void *cls, | |||
2243 | if (GNUNET_YES == log_route_details_stderr) | 2256 | if (GNUNET_YES == log_route_details_stderr) |
2244 | { | 2257 | { |
2245 | char *tmp; | 2258 | char *tmp; |
2259 | char *pp; | ||
2260 | char *gp; | ||
2246 | 2261 | ||
2262 | gp = GNUNET_STRINGS_pp2s (get_path, | ||
2263 | get_path_length); | ||
2264 | pp = GNUNET_STRINGS_pp2s (put_path, | ||
2265 | put_path_length); | ||
2247 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); | 2266 | tmp = GNUNET_strdup (GNUNET_i2s (&my_identity)); |
2248 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, | 2267 | LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, |
2249 | "R5N RESULT %s: %s->%s (%u)\n", | 2268 | "R5N RESULT %s: %s->%s (GP: %s, PP: %s)\n", |
2250 | GNUNET_h2s (&prm->key), | 2269 | GNUNET_h2s (&prm->key), |
2251 | GNUNET_i2s (peer->id), | 2270 | GNUNET_i2s (peer->id), |
2252 | tmp, | 2271 | tmp, |
2253 | get_path_length + 1); | 2272 | gp, |
2273 | pp); | ||
2274 | GNUNET_free (gp); | ||
2275 | GNUNET_free (pp); | ||
2254 | GNUNET_free (tmp); | 2276 | GNUNET_free (tmp); |
2255 | } | 2277 | } |
2256 | /* if we got a HELLO, consider it for our own routing table */ | 2278 | /* if we got a HELLO, consider it for our own routing table */ |
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c index 72480536c..29c08dd50 100644 --- a/src/dht/plugin_block_dht.c +++ b/src/dht/plugin_block_dht.c | |||
@@ -95,13 +95,11 @@ block_plugin_dht_create_group (void *cls, | |||
95 | const char *guard; | 95 | const char *guard; |
96 | 96 | ||
97 | guard = va_arg (va, const char *); | 97 | guard = va_arg (va, const char *); |
98 | if (0 == memcmp (guard, | 98 | if (0 == strcmp (guard, |
99 | "seen-set-size", | 99 | "seen-set-size")) |
100 | strlen ("seen-set-size"))) | ||
101 | bf_size = compute_bloomfilter_size (va_arg (va, unsigned int)); | 100 | bf_size = compute_bloomfilter_size (va_arg (va, unsigned int)); |
102 | else if (0 == memcmp (guard, | 101 | else if (0 == strcmp (guard, |
103 | "filter-size", | 102 | "filter-size")) |
104 | strlen ("filter-size"))) | ||
105 | bf_size = va_arg (va, unsigned int); | 103 | bf_size = va_arg (va, unsigned int); |
106 | else | 104 | else |
107 | { | 105 | { |