diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-02-19 16:06:34 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-19 16:06:34 +0100 |
commit | 95ffa9b9ac9711539aac3feb15eefcfebfc14825 (patch) | |
tree | 9f4d5a853807d60f8e1a786ff3d48eb078792e68 /src/datacache | |
parent | 901b2fcc56a618a0d3e9d3e65c8688f84e3e180c (diff) | |
download | gnunet-95ffa9b9ac9711539aac3feb15eefcfebfc14825.tar.gz gnunet-95ffa9b9ac9711539aac3feb15eefcfebfc14825.zip |
-fix htons/htonl bug introduced by message format change
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/plugin_datacache_heap.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c index 2756315fb..09e66d892 100644 --- a/src/datacache/plugin_datacache_heap.c +++ b/src/datacache/plugin_datacache_heap.c | |||
@@ -158,7 +158,7 @@ struct PutContext | |||
158 | * @param value an existing value | 158 | * @param value an existing value |
159 | * @return #GNUNET_YES if not found (to continue to iterate) | 159 | * @return #GNUNET_YES if not found (to continue to iterate) |
160 | */ | 160 | */ |
161 | static int | 161 | static enum GNUNET_GenericReturnValue |
162 | put_cb (void *cls, | 162 | put_cb (void *cls, |
163 | const struct GNUNET_HashCode *key, | 163 | const struct GNUNET_HashCode *key, |
164 | void *value) | 164 | void *value) |
@@ -224,15 +224,20 @@ heap_plugin_put (void *cls, | |||
224 | { | 224 | { |
225 | struct Plugin *plugin = cls; | 225 | struct Plugin *plugin = cls; |
226 | struct Value *val; | 226 | struct Value *val; |
227 | struct PutContext put_ctx; | 227 | struct PutContext put_ctx = { |
228 | 228 | .data = data, | |
229 | put_ctx.found = GNUNET_NO; | 229 | .size = size, |
230 | put_ctx.data = data; | 230 | .path_info = path_info, |
231 | put_ctx.size = size; | 231 | .path_info_len = path_info_len, |
232 | put_ctx.path_info = path_info; | 232 | .discard_time = discard_time, |
233 | put_ctx.path_info_len = path_info_len; | 233 | .type = type |
234 | put_ctx.discard_time = discard_time; | 234 | }; |
235 | put_ctx.type = type; | 235 | |
236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
237 | "Storing %u bytes under key %s with path length %u\n", | ||
238 | (unsigned int) size, | ||
239 | GNUNET_h2s (key), | ||
240 | path_info_len); | ||
236 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->map, | 241 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->map, |
237 | key, | 242 | key, |
238 | &put_cb, | 243 | &put_cb, |
@@ -313,12 +318,25 @@ get_cb (void *cls, | |||
313 | struct Value *val = value; | 318 | struct Value *val = value; |
314 | int ret; | 319 | int ret; |
315 | 320 | ||
316 | if ((get_ctx->type != val->type) && | 321 | if ( (get_ctx->type != val->type) && |
317 | (GNUNET_BLOCK_TYPE_ANY != get_ctx->type)) | 322 | (GNUNET_BLOCK_TYPE_ANY != get_ctx->type) ) |
323 | { | ||
324 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
325 | "Result for key %s does not match block type %d\n", | ||
326 | GNUNET_h2s (key), | ||
327 | get_ctx->type); | ||
318 | return GNUNET_OK; | 328 | return GNUNET_OK; |
319 | if (0 == | 329 | } |
320 | GNUNET_TIME_absolute_get_remaining (val->discard_time).rel_value_us) | 330 | if (GNUNET_TIME_absolute_is_past (val->discard_time)) |
331 | { | ||
332 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
333 | "Result for key %s is expired\n", | ||
334 | GNUNET_h2s (key)); | ||
321 | return GNUNET_OK; | 335 | return GNUNET_OK; |
336 | } | ||
337 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
338 | "Found result for key %s\n", | ||
339 | GNUNET_h2s (key)); | ||
322 | if (NULL != get_ctx->iter) | 340 | if (NULL != get_ctx->iter) |
323 | ret = get_ctx->iter (get_ctx->iter_cls, | 341 | ret = get_ctx->iter (get_ctx->iter_cls, |
324 | key, | 342 | key, |