diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-29 08:29:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-29 08:29:16 +0000 |
commit | 4221441f74e1fcdf87ee9811b6f97d0cfd6799a4 (patch) | |
tree | ef93b5ffbf3eff42c3bc8c0c2b5e640c2d8a25fd /src/dht | |
parent | 11a321ac1c47f39d44fa58149501a7c12d62e379 (diff) | |
download | gnunet-4221441f74e1fcdf87ee9811b6f97d0cfd6799a4.tar.gz gnunet-4221441f74e1fcdf87ee9811b6f97d0cfd6799a4.zip |
-doxygen
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.c | 20 | ||||
-rw-r--r-- | src/dht/gnunet-service-wdht_datacache.c | 82 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_datacache.c | 96 |
3 files changed, 120 insertions, 78 deletions
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c index 0b067dca4..36cba9a3d 100644 --- a/src/dht/gnunet-service-dht_datacache.c +++ b/src/dht/gnunet-service-dht_datacache.c | |||
@@ -17,7 +17,6 @@ | |||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file dht/gnunet-service-dht_datacache.c | 21 | * @file dht/gnunet-service-dht_datacache.c |
23 | * @brief GNUnet DHT service's datacache integration | 22 | * @brief GNUnet DHT service's datacache integration |
@@ -78,11 +77,20 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
78 | GNUNET_STATISTICS_update (GDS_stats, | 77 | GNUNET_STATISTICS_update (GDS_stats, |
79 | gettext_noop ("# ITEMS stored in datacache"), 1, | 78 | gettext_noop ("# ITEMS stored in datacache"), 1, |
80 | GNUNET_NO); | 79 | GNUNET_NO); |
81 | r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration, | 80 | r = GNUNET_DATACACHE_put (datacache, |
82 | put_path_length, put_path); | 81 | key, |
82 | data_size, | ||
83 | data, | ||
84 | type, | ||
85 | expiration, | ||
86 | put_path_length, | ||
87 | put_path); | ||
83 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 88 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
84 | "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n", | 89 | "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n", |
85 | GNUNET_h2s (key), data_size, r, put_path_length); | 90 | GNUNET_h2s (key), |
91 | data_size, | ||
92 | r, | ||
93 | put_path_length); | ||
86 | } | 94 | } |
87 | 95 | ||
88 | 96 | ||
@@ -112,7 +120,7 @@ struct GetRequestContext | |||
112 | size_t xquery_size; | 120 | size_t xquery_size; |
113 | 121 | ||
114 | /** | 122 | /** |
115 | * Mutator value for the reply_bf, see gnunet_block_lib.h | 123 | * Mutator value for the @e reply_bf, see gnunet_block_lib.h |
116 | */ | 124 | */ |
117 | uint32_t reply_bf_mutator; | 125 | uint32_t reply_bf_mutator; |
118 | 126 | ||
@@ -126,7 +134,7 @@ struct GetRequestContext | |||
126 | /** | 134 | /** |
127 | * Iterator for local get request results, | 135 | * Iterator for local get request results, |
128 | * | 136 | * |
129 | * @param cls closure for iterator, a DatacacheGetContext | 137 | * @param cls closure for iterator, a `struct GetRequestContext` |
130 | * @param exp when does this value expire? | 138 | * @param exp when does this value expire? |
131 | * @param key the key this data is stored under | 139 | * @param key the key this data is stored under |
132 | * @param size the size of the data identified by key | 140 | * @param size the size of the data identified by key |
diff --git a/src/dht/gnunet-service-wdht_datacache.c b/src/dht/gnunet-service-wdht_datacache.c index 7bfb565a4..42fa884cf 100644 --- a/src/dht/gnunet-service-wdht_datacache.c +++ b/src/dht/gnunet-service-wdht_datacache.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | Copyright (C) 2009, 2010, 2011, 2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file dht/gnunet-service-dht_datacache.c | 22 | * @file dht/gnunet-service-wdht_datacache.c |
23 | * @brief GNUnet DHT service's datacache integration | 23 | * @brief GNUnet DHT service's datacache integration |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Nathan Evans | 25 | * @author Nathan Evans |
@@ -48,18 +48,19 @@ static struct GNUNET_DATACACHE_Handle *datacache; | |||
48 | * | 48 | * |
49 | * @param expiration when will the reply expire | 49 | * @param expiration when will the reply expire |
50 | * @param key the query this reply is for | 50 | * @param key the query this reply is for |
51 | * @param put_path_length number of peers in 'put_path' | 51 | * @param put_path_length number of peers in @a put_path |
52 | * @param put_path path the reply took on put | 52 | * @param put_path path the reply took on put |
53 | * @param type type of the reply | 53 | * @param type type of the reply |
54 | * @param data_size number of bytes in 'data' | 54 | * @param data_size number of bytes in @a data |
55 | * @param data application payload data | 55 | * @param data application payload data |
56 | */ | 56 | */ |
57 | void | 57 | void |
58 | GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | 58 | GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, |
59 | const struct GNUNET_HashCode * key, | 59 | const struct GNUNET_HashCode *key, |
60 | unsigned int put_path_length, | 60 | unsigned int put_path_length, |
61 | const struct GNUNET_PeerIdentity *put_path, | 61 | const struct GNUNET_PeerIdentity *put_path, |
62 | enum GNUNET_BLOCK_Type type, size_t data_size, | 62 | enum GNUNET_BLOCK_Type type, |
63 | size_t data_size, | ||
63 | const void *data) | 64 | const void *data) |
64 | { | 65 | { |
65 | int r; | 66 | int r; |
@@ -67,7 +68,7 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
67 | if (NULL == datacache) | 68 | if (NULL == datacache) |
68 | { | 69 | { |
69 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 70 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
70 | _("%s request received, but have no datacache!\n"), "PUT"); | 71 | _("PUT request received, but have no datacache!\n")); |
71 | return; | 72 | return; |
72 | } | 73 | } |
73 | if (data_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 74 | if (data_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
@@ -77,19 +78,27 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
77 | } | 78 | } |
78 | 79 | ||
79 | /* Put size is actual data size plus struct overhead plus path length (if any) */ | 80 | /* Put size is actual data size plus struct overhead plus path length (if any) */ |
80 | GNUNET_STATISTICS_update (GDS_stats, | 81 | r = GNUNET_DATACACHE_put (datacache, |
81 | gettext_noop ("# ITEMS stored in datacache"), 1, | 82 | key, |
82 | GNUNET_NO); | 83 | data_size, |
83 | 84 | data, | |
84 | struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id(); | 85 | type, |
85 | DEBUG("DATACACHE_PUT KEY = %s, peer = %s\n",GNUNET_h2s(key),GNUNET_i2s(&peer)); | 86 | expiration, |
86 | r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration, | 87 | put_path_length, |
87 | put_path_length, put_path); | 88 | put_path); |
89 | if (GNUNET_OK == r) | ||
90 | GNUNET_STATISTICS_update (GDS_stats, | ||
91 | gettext_noop ("# ITEMS stored in datacache"), 1, | ||
92 | GNUNET_NO); | ||
88 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 93 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
89 | "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n", | 94 | "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n", |
90 | GNUNET_h2s (key), data_size, r, put_path_length); | 95 | GNUNET_h2s (key), |
96 | data_size, | ||
97 | r, | ||
98 | put_path_length); | ||
91 | } | 99 | } |
92 | 100 | ||
101 | |||
93 | /** | 102 | /** |
94 | * List of peers in the get path. | 103 | * List of peers in the get path. |
95 | */ | 104 | */ |
@@ -133,17 +142,17 @@ struct GetRequestContext | |||
133 | struct GNUNET_HashCode key; | 142 | struct GNUNET_HashCode key; |
134 | 143 | ||
135 | /** | 144 | /** |
136 | * Number of bytes in xquery. | 145 | * Number of bytes in @e xquery. |
137 | */ | 146 | */ |
138 | size_t xquery_size; | 147 | size_t xquery_size; |
139 | 148 | ||
140 | /** | 149 | /** |
141 | * Mutator value for the reply_bf, see gnunet_block_lib.h | 150 | * Mutator value for the @e reply_bf, see gnunet_block_lib.h |
142 | */ | 151 | */ |
143 | uint32_t reply_bf_mutator; | 152 | uint32_t reply_bf_mutator; |
144 | 153 | ||
145 | /** | 154 | /** |
146 | * Total number of peers in get path. | 155 | * Total number of peers in @e head. |
147 | */ | 156 | */ |
148 | unsigned int get_path_length; | 157 | unsigned int get_path_length; |
149 | 158 | ||
@@ -290,16 +299,17 @@ datacache_get_iterator (void *cls, | |||
290 | * @param key the query | 299 | * @param key the query |
291 | * @param type requested data type | 300 | * @param type requested data type |
292 | * @param xquery extended query | 301 | * @param xquery extended query |
293 | * @param xquery_size number of bytes in xquery | 302 | * @param xquery_size number of bytes in @a xquery |
294 | * @param reply_bf where the reply bf is (to be) stored, possibly updated, can be NULL | 303 | * @param reply_bf where the reply bf is (to be) stored, possibly updated, can be NULL |
295 | * @param reply_bf_mutator mutation value for reply_bf | 304 | * @param reply_bf_mutator mutation value for @a reply_bf |
305 | * @param get_path_length Total number of peers in @a get_path | ||
306 | * @param get_path Peers query has traversed during GET | ||
296 | * @return evaluation result for the local replies | 307 | * @return evaluation result for the local replies |
297 | * @get_path_length Total number of peers in get path | ||
298 | * @get_path Peers in get path. | ||
299 | */ | 308 | */ |
300 | enum GNUNET_BLOCK_EvaluationResult | 309 | enum GNUNET_BLOCK_EvaluationResult |
301 | GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, | 310 | GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key, |
302 | enum GNUNET_BLOCK_Type type, const void *xquery, | 311 | enum GNUNET_BLOCK_Type type, |
312 | const void *xquery, | ||
303 | size_t xquery_size, | 313 | size_t xquery_size, |
304 | struct GNUNET_CONTAINER_BloomFilter **reply_bf, | 314 | struct GNUNET_CONTAINER_BloomFilter **reply_bf, |
305 | uint32_t reply_bf_mutator, | 315 | uint32_t reply_bf_mutator, |
@@ -324,15 +334,13 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, | |||
324 | ctx.reply_bf_mutator = reply_bf_mutator; | 334 | ctx.reply_bf_mutator = reply_bf_mutator; |
325 | ctx.get_path_length = get_path_length; | 335 | ctx.get_path_length = get_path_length; |
326 | 336 | ||
327 | if (next_hop != NULL) | 337 | if (NULL != next_hop) |
328 | { | 338 | ctx.next_hop = *next_hop; |
329 | memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity)); | ||
330 | } | ||
331 | unsigned int i = 0; | 339 | unsigned int i = 0; |
332 | 340 | ||
333 | ctx.head = NULL; | 341 | ctx.head = NULL; |
334 | ctx.tail = NULL; | 342 | ctx.tail = NULL; |
335 | if (get_path != NULL) | 343 | if (NULL != get_path) |
336 | { | 344 | { |
337 | while (i < get_path_length) | 345 | while (i < get_path_length) |
338 | { | 346 | { |
@@ -346,9 +354,15 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, | |||
346 | } | 354 | } |
347 | } | 355 | } |
348 | 356 | ||
349 | r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, | 357 | r = GNUNET_DATACACHE_get (datacache, |
358 | key, | ||
359 | type, | ||
360 | &datacache_get_iterator, | ||
350 | &ctx); | 361 | &ctx); |
351 | DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n",GNUNET_h2s (key), ctx.eval, r); | 362 | DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n", |
363 | GNUNET_h2s (key), | ||
364 | ctx.eval, | ||
365 | r); | ||
352 | return ctx.eval; | 366 | return ctx.eval; |
353 | } | 367 | } |
354 | 368 | ||
@@ -369,7 +383,7 @@ GDS_DATACACHE_init () | |||
369 | void | 383 | void |
370 | GDS_DATACACHE_done () | 384 | GDS_DATACACHE_done () |
371 | { | 385 | { |
372 | if (datacache != NULL) | 386 | if (NULL != datacache) |
373 | { | 387 | { |
374 | GNUNET_DATACACHE_destroy (datacache); | 388 | GNUNET_DATACACHE_destroy (datacache); |
375 | datacache = NULL; | 389 | datacache = NULL; |
@@ -377,4 +391,4 @@ GDS_DATACACHE_done () | |||
377 | } | 391 | } |
378 | 392 | ||
379 | 393 | ||
380 | /* end of gnunet-service-dht_datacache.c */ | 394 | /* end of gnunet-service-wdht_datacache.c */ |
diff --git a/src/dht/gnunet-service-xdht_datacache.c b/src/dht/gnunet-service-xdht_datacache.c index 9fbff7dfb..5a4fff8cc 100644 --- a/src/dht/gnunet-service-xdht_datacache.c +++ b/src/dht/gnunet-service-xdht_datacache.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | Copyright (C) 2009, 2010, 2011, 2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -17,9 +17,8 @@ | |||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file dht/gnunet-service-dht_datacache.c | 21 | * @file dht/gnunet-service-xdht_datacache.c |
23 | * @brief GNUnet DHT service's datacache integration | 22 | * @brief GNUnet DHT service's datacache integration |
24 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
25 | * @author Nathan Evans | 24 | * @author Nathan Evans |
@@ -49,18 +48,19 @@ static struct GNUNET_DATACACHE_Handle *datacache; | |||
49 | * | 48 | * |
50 | * @param expiration when will the reply expire | 49 | * @param expiration when will the reply expire |
51 | * @param key the query this reply is for | 50 | * @param key the query this reply is for |
52 | * @param put_path_length number of peers in 'put_path' | 51 | * @param put_path_length number of peers in @a put_path |
53 | * @param put_path path the reply took on put | 52 | * @param put_path path the reply took on put |
54 | * @param type type of the reply | 53 | * @param type type of the reply |
55 | * @param data_size number of bytes in 'data' | 54 | * @param data_size number of bytes in @a data |
56 | * @param data application payload data | 55 | * @param data application payload data |
57 | */ | 56 | */ |
58 | void | 57 | void |
59 | GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | 58 | GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, |
60 | const struct GNUNET_HashCode * key, | 59 | const struct GNUNET_HashCode *key, |
61 | unsigned int put_path_length, | 60 | unsigned int put_path_length, |
62 | const struct GNUNET_PeerIdentity *put_path, | 61 | const struct GNUNET_PeerIdentity *put_path, |
63 | enum GNUNET_BLOCK_Type type, size_t data_size, | 62 | enum GNUNET_BLOCK_Type type, |
63 | size_t data_size, | ||
64 | const void *data) | 64 | const void *data) |
65 | { | 65 | { |
66 | int r; | 66 | int r; |
@@ -68,7 +68,7 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
68 | if (NULL == datacache) | 68 | if (NULL == datacache) |
69 | { | 69 | { |
70 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 70 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
71 | _("%s request received, but have no datacache!\n"), "PUT"); | 71 | "PUT request received, but have no datacache!\n"); |
72 | return; | 72 | return; |
73 | } | 73 | } |
74 | if (data_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 74 | if (data_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
@@ -78,19 +78,27 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* Put size is actual data size plus struct overhead plus path length (if any) */ | 80 | /* Put size is actual data size plus struct overhead plus path length (if any) */ |
81 | GNUNET_STATISTICS_update (GDS_stats, | 81 | r = GNUNET_DATACACHE_put (datacache, |
82 | gettext_noop ("# ITEMS stored in datacache"), 1, | 82 | key, |
83 | GNUNET_NO); | 83 | data_size, |
84 | 84 | data, | |
85 | struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id(); | 85 | type, |
86 | DEBUG("DATACACHE_PUT KEY = %s, peer = %s\n",GNUNET_h2s(key),GNUNET_i2s(&peer)); | 86 | expiration, |
87 | r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration, | 87 | put_path_length, |
88 | put_path_length, put_path); | 88 | put_path); |
89 | if (GNUNET_OK == r) | ||
90 | GNUNET_STATISTICS_update (GDS_stats, | ||
91 | gettext_noop ("# ITEMS stored in datacache"), 1, | ||
92 | GNUNET_NO); | ||
89 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 93 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
90 | "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n", | 94 | "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n", |
91 | GNUNET_h2s (key), data_size, r, put_path_length); | 95 | GNUNET_h2s (key), |
96 | data_size, | ||
97 | r, | ||
98 | put_path_length); | ||
92 | } | 99 | } |
93 | 100 | ||
101 | |||
94 | /** | 102 | /** |
95 | * List of peers in the get path. | 103 | * List of peers in the get path. |
96 | */ | 104 | */ |
@@ -139,7 +147,7 @@ struct GetRequestContext | |||
139 | size_t xquery_size; | 147 | size_t xquery_size; |
140 | 148 | ||
141 | /** | 149 | /** |
142 | * Mutator value for the reply_bf, see gnunet_block_lib.h | 150 | * Mutator value for the @e reply_bf, see gnunet_block_lib.h |
143 | */ | 151 | */ |
144 | uint32_t reply_bf_mutator; | 152 | uint32_t reply_bf_mutator; |
145 | 153 | ||
@@ -181,10 +189,10 @@ struct GetRequestContext | |||
181 | * Iterator for local get request results, | 189 | * Iterator for local get request results, |
182 | * | 190 | * |
183 | * @param cls closure for iterator, a `struct GetRequestContext` | 191 | * @param cls closure for iterator, a `struct GetRequestContext` |
184 | * @param key the key this data is stored under | 192 | * @param key the key this @a data is stored under |
185 | * @param size the size of the data identified by key | 193 | * @param size the size of the data identified by key |
186 | * @param data the actual data | 194 | * @param data the actual data |
187 | * @param type the type of the data | 195 | * @param type the type of the @a data |
188 | * @param exp when does this value expire? | 196 | * @param exp when does this value expire? |
189 | * @param put_path_length number of peers in @a put_path | 197 | * @param put_path_length number of peers in @a put_path |
190 | * @param put_path path the reply took on put | 198 | * @param put_path path the reply took on put |
@@ -241,11 +249,17 @@ datacache_get_iterator (void *cls, | |||
241 | i++; | 249 | i++; |
242 | iterator = iterator->next; | 250 | iterator = iterator->next; |
243 | } | 251 | } |
244 | GDS_NEIGHBOURS_send_get_result (key,type, &(ctx->next_hop),&(ctx->source_peer), | 252 | GDS_NEIGHBOURS_send_get_result (key,type, |
245 | put_path_length, put_path, ctx->get_path_length, | 253 | &ctx->next_hop, |
246 | get_path, exp, data, size ); | 254 | &ctx->source_peer, |
255 | put_path_length, | ||
256 | put_path, | ||
257 | ctx->get_path_length, | ||
258 | get_path, | ||
259 | exp, | ||
260 | data, | ||
261 | size); | ||
247 | GNUNET_free_non_null (get_path); | 262 | GNUNET_free_non_null (get_path); |
248 | |||
249 | break; | 263 | break; |
250 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: | 264 | case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: |
251 | GNUNET_STATISTICS_update (GDS_stats, | 265 | GNUNET_STATISTICS_update (GDS_stats, |
@@ -277,7 +291,8 @@ datacache_get_iterator (void *cls, | |||
277 | ("# Unsupported RESULTS found in datacache"), 1, | 291 | ("# Unsupported RESULTS found in datacache"), 1, |
278 | GNUNET_NO); | 292 | GNUNET_NO); |
279 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 293 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
280 | _("Unsupported block type (%u) in local response!\n"), type); | 294 | _("Unsupported block type (%u) in local response!\n"), |
295 | type); | ||
281 | break; | 296 | break; |
282 | } | 297 | } |
283 | 298 | ||
@@ -291,16 +306,17 @@ datacache_get_iterator (void *cls, | |||
291 | * @param key the query | 306 | * @param key the query |
292 | * @param type requested data type | 307 | * @param type requested data type |
293 | * @param xquery extended query | 308 | * @param xquery extended query |
294 | * @param xquery_size number of bytes in xquery | 309 | * @param xquery_size number of bytes in @a xquery |
295 | * @param reply_bf where the reply bf is (to be) stored, possibly updated, can be NULL | 310 | * @param reply_bf where the reply bf is (to be) stored, possibly updated, can be NULL |
296 | * @param reply_bf_mutator mutation value for reply_bf | 311 | * @param reply_bf_mutator mutation value for @a reply_bf |
297 | * @return evaluation result for the local replies | 312 | * @return evaluation result for the local replies |
298 | * @get_path_length Total number of peers in get path | 313 | * @get_path_length Total number of peers in get path |
299 | * @get_path Peers in get path. | 314 | * @get_path Peers in get path. |
300 | */ | 315 | */ |
301 | enum GNUNET_BLOCK_EvaluationResult | 316 | enum GNUNET_BLOCK_EvaluationResult |
302 | GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, | 317 | GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key, |
303 | enum GNUNET_BLOCK_Type type, const void *xquery, | 318 | enum GNUNET_BLOCK_Type type, |
319 | const void *xquery, | ||
304 | size_t xquery_size, | 320 | size_t xquery_size, |
305 | struct GNUNET_CONTAINER_BloomFilter **reply_bf, | 321 | struct GNUNET_CONTAINER_BloomFilter **reply_bf, |
306 | uint32_t reply_bf_mutator, | 322 | uint32_t reply_bf_mutator, |
@@ -325,15 +341,13 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, | |||
325 | ctx.reply_bf_mutator = reply_bf_mutator; | 341 | ctx.reply_bf_mutator = reply_bf_mutator; |
326 | ctx.get_path_length = get_path_length; | 342 | ctx.get_path_length = get_path_length; |
327 | 343 | ||
328 | if (next_hop != NULL) | 344 | if (NULL != next_hop) |
329 | { | 345 | ctx.next_hop = *next_hop; |
330 | memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity)); | ||
331 | } | ||
332 | unsigned int i = 0; | 346 | unsigned int i = 0; |
333 | 347 | ||
334 | ctx.head = NULL; | 348 | ctx.head = NULL; |
335 | ctx.tail = NULL; | 349 | ctx.tail = NULL; |
336 | if (get_path != NULL) | 350 | if (NULL != get_path) |
337 | { | 351 | { |
338 | while (i < get_path_length) | 352 | while (i < get_path_length) |
339 | { | 353 | { |
@@ -347,9 +361,15 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, | |||
347 | } | 361 | } |
348 | } | 362 | } |
349 | 363 | ||
350 | r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, | 364 | r = GNUNET_DATACACHE_get (datacache, |
365 | key, | ||
366 | type, | ||
367 | &datacache_get_iterator, | ||
351 | &ctx); | 368 | &ctx); |
352 | DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n",GNUNET_h2s (key), ctx.eval, r); | 369 | DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n", |
370 | GNUNET_h2s (key), | ||
371 | ctx.eval, | ||
372 | r); | ||
353 | return ctx.eval; | 373 | return ctx.eval; |
354 | } | 374 | } |
355 | 375 | ||
@@ -370,7 +390,7 @@ GDS_DATACACHE_init () | |||
370 | void | 390 | void |
371 | GDS_DATACACHE_done () | 391 | GDS_DATACACHE_done () |
372 | { | 392 | { |
373 | if (datacache != NULL) | 393 | if (NULL != datacache) |
374 | { | 394 | { |
375 | GNUNET_DATACACHE_destroy (datacache); | 395 | GNUNET_DATACACHE_destroy (datacache); |
376 | datacache = NULL; | 396 | datacache = NULL; |
@@ -378,4 +398,4 @@ GDS_DATACACHE_done () | |||
378 | } | 398 | } |
379 | 399 | ||
380 | 400 | ||
381 | /* end of gnunet-service-dht_datacache.c */ | 401 | /* end of gnunet-service-xdht_datacache.c */ |