diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-09-27 12:46:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-09-27 12:46:48 +0000 |
commit | 1f3e06a9d063aefd82ff5081f340a3ce5783ca9b (patch) | |
tree | 21c32a583fc253eb4609fdabaf1ab00305824a4d /src/dht/gnunet-service-dht_routing.c | |
parent | fb8d41530a536dda3dba02ea3674475db6570f04 (diff) | |
download | gnunet-1f3e06a9d063aefd82ff5081f340a3ce5783ca9b.tar.gz gnunet-1f3e06a9d063aefd82ff5081f340a3ce5783ca9b.zip |
process find peer requests and replies
Diffstat (limited to 'src/dht/gnunet-service-dht_routing.c')
-rw-r--r-- | src/dht/gnunet-service-dht_routing.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index 41996d654..5a87f8b32 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c | |||
@@ -169,6 +169,8 @@ process (void *cls, | |||
169 | enum GNUNET_BLOCK_EvaluationResult eval; | 169 | enum GNUNET_BLOCK_EvaluationResult eval; |
170 | unsigned int gpl; | 170 | unsigned int gpl; |
171 | unsigned int ppl; | 171 | unsigned int ppl; |
172 | GNUNET_HashCode hc; | ||
173 | const GNUNET_HashCode *eval_key; | ||
172 | 174 | ||
173 | if ( (rr->type != GNUNET_BLOCK_TYPE_ANY) && | 175 | if ( (rr->type != GNUNET_BLOCK_TYPE_ANY) && |
174 | (rr->type != pc->type) ) | 176 | (rr->type != pc->type) ) |
@@ -184,9 +186,26 @@ process (void *cls, | |||
184 | gpl = 0; | 186 | gpl = 0; |
185 | ppl = 0; | 187 | ppl = 0; |
186 | } | 188 | } |
189 | if ( (0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && | ||
190 | (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO) ) | ||
191 | { | ||
192 | /* key may not match HELLO, which is OK since | ||
193 | the search is approximate. Still, the evaluation | ||
194 | would fail since the match is not exact. So | ||
195 | we fake it by changing the key to the actual PID ... */ | ||
196 | GNUNET_BLOCK_get_key (GDS_block_context, | ||
197 | GNUNET_BLOCK_TYPE_DHT_HELLO, | ||
198 | pc->data, pc->data_size, | ||
199 | &hc); | ||
200 | eval_key = &hc; | ||
201 | } | ||
202 | else | ||
203 | { | ||
204 | eval_key = key; | ||
205 | } | ||
187 | eval = GNUNET_BLOCK_evaluate (GDS_block_context, | 206 | eval = GNUNET_BLOCK_evaluate (GDS_block_context, |
188 | pc->type, | 207 | pc->type, |
189 | key, | 208 | eval_key, |
190 | &rr->reply_bf, | 209 | &rr->reply_bf, |
191 | rr->reply_bf_mutator, | 210 | rr->reply_bf_mutator, |
192 | rr->xquery, | 211 | rr->xquery, |