diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-09 17:48:27 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-09 21:18:47 +0100 |
commit | d829597ee90dccffffd46a082372af6b35042130 (patch) | |
tree | 3287e54a2401ccf7050f6588afb01043e7ea8be9 /src/dht | |
parent | 4bf29b6e9f9b0223f9497f7664e96e3f333df861 (diff) | |
download | gnunet-d829597ee90dccffffd46a082372af6b35042130.tar.gz gnunet-d829597ee90dccffffd46a082372af6b35042130.zip |
cosmetics
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 12 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_routing.c | 10 | ||||
-rw-r--r-- | src/dht/plugin_block_dht.c | 12 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 574ed9ad0..0d3594d1a 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1830,10 +1830,16 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, | |||
1830 | /* first, check about our own HELLO */ | 1830 | /* first, check about our own HELLO */ |
1831 | if (NULL != GDS_my_hello) | 1831 | if (NULL != GDS_my_hello) |
1832 | { | 1832 | { |
1833 | GNUNET_BLOCK_mingle_hash (&my_identity_hash, bf_mutator, &mhash); | 1833 | GNUNET_BLOCK_mingle_hash (&my_identity_hash, |
1834 | bf_mutator, | ||
1835 | &mhash); | ||
1834 | if ((NULL == bf) || | 1836 | if ((NULL == bf) || |
1835 | (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash))) | 1837 | (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash))) |
1836 | { | 1838 | { |
1839 | size_t hello_size; | ||
1840 | |||
1841 | hello_size = GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) GDS_my_hello); | ||
1842 | GNUNET_break (hello_size >= sizeof (struct GNUNET_MessageHeader)); | ||
1837 | GDS_NEIGHBOURS_handle_reply (sender, | 1843 | GDS_NEIGHBOURS_handle_reply (sender, |
1838 | GNUNET_BLOCK_TYPE_DHT_HELLO, | 1844 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
1839 | GNUNET_TIME_relative_to_absolute | 1845 | GNUNET_TIME_relative_to_absolute |
@@ -1844,9 +1850,7 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, | |||
1844 | 0, | 1850 | 0, |
1845 | NULL, | 1851 | NULL, |
1846 | GDS_my_hello, | 1852 | GDS_my_hello, |
1847 | GNUNET_HELLO_size ((const struct | 1853 | hello_size); |
1848 | GNUNET_HELLO_Message *) | ||
1849 | GDS_my_hello)); | ||
1850 | } | 1854 | } |
1851 | else | 1855 | else |
1852 | { | 1856 | { |
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index 48bece35e..38e5fc1c7 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c | |||
@@ -183,15 +183,17 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
183 | gpl = 0; | 183 | gpl = 0; |
184 | ppl = 0; | 184 | ppl = 0; |
185 | } | 185 | } |
186 | if ((0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && | 186 | if ( (0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && |
187 | (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO)) | 187 | (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO) ) |
188 | { | 188 | { |
189 | /* key may not match HELLO, which is OK since | 189 | /* key may not match HELLO, which is OK since |
190 | * the search is approximate. Still, the evaluation | 190 | * the search is approximate. Still, the evaluation |
191 | * would fail since the match is not exact. So | 191 | * would fail since the match is not exact. So |
192 | * we fake it by changing the key to the actual PID ... */ | 192 | * we fake it by changing the key to the actual PID ... */ |
193 | GNUNET_BLOCK_get_key (GDS_block_context, GNUNET_BLOCK_TYPE_DHT_HELLO, | 193 | GNUNET_BLOCK_get_key (GDS_block_context, |
194 | pc->data, pc->data_size, &hc); | 194 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
195 | pc->data, pc->data_size, | ||
196 | &hc); | ||
195 | eval_key = &hc; | 197 | eval_key = &hc; |
196 | } | 198 | } |
197 | else | 199 | else |
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c index 17594efcb..4256a0fe6 100644 --- a/src/dht/plugin_block_dht.c +++ b/src/dht/plugin_block_dht.c | |||
@@ -70,7 +70,7 @@ block_plugin_dht_evaluate (void *cls, | |||
70 | 70 | ||
71 | if (type != GNUNET_BLOCK_TYPE_DHT_HELLO) | 71 | if (type != GNUNET_BLOCK_TYPE_DHT_HELLO) |
72 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; | 72 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; |
73 | if (xquery_size != 0) | 73 | if (0 != xquery_size) |
74 | { | 74 | { |
75 | GNUNET_break_op (0); | 75 | GNUNET_break_op (0); |
76 | return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; | 76 | return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; |
@@ -121,14 +121,16 @@ block_plugin_dht_evaluate (void *cls, | |||
121 | * @param type block type | 121 | * @param type block type |
122 | * @param block block to get the key for | 122 | * @param block block to get the key for |
123 | * @param block_size number of bytes @a block | 123 | * @param block_size number of bytes @a block |
124 | * @param key set to the key (query) for the given block | 124 | * @param[out] key set to the key (query) for the given block |
125 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported | 125 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported |
126 | * (or if extracting a key from a block of this type does not work) | 126 | * (or if extracting a key from a block of this type does not work) |
127 | */ | 127 | */ |
128 | static int | 128 | static int |
129 | block_plugin_dht_get_key (void *cls, enum GNUNET_BLOCK_Type type, | 129 | block_plugin_dht_get_key (void *cls, |
130 | const void *block, size_t block_size, | 130 | enum GNUNET_BLOCK_Type type, |
131 | struct GNUNET_HashCode * key) | 131 | const void *block, |
132 | size_t block_size, | ||
133 | struct GNUNET_HashCode *key) | ||
132 | { | 134 | { |
133 | const struct GNUNET_MessageHeader *msg; | 135 | const struct GNUNET_MessageHeader *msg; |
134 | const struct GNUNET_HELLO_Message *hello; | 136 | const struct GNUNET_HELLO_Message *hello; |