gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit b78259a373ba8f3bbd7ee5a46566244ee763f234
parent b402d9955d3384204a71a124b1e688a7b17866a9
Author: Jacki <jacki@thejackimonster.de>
Date:   Wed, 18 Mar 2026 01:24:45 +0100

fs: reserve at least one on-demand-block for indexed files

Signed-off-by: Jacki <jacki@thejackimonster.de>

Diffstat:
Msrc/service/datastore/gnunet-service-datastore.c | 15++++++++++++---
Msrc/service/fs/fs_publish.c | 15+++++++++------
2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/src/service/datastore/gnunet-service-datastore.c b/src/service/datastore/gnunet-service-datastore.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet - Copyright (C) 2004-2014, 2016 GNUnet e.V. + Copyright (C) 2004-2014, 2016, 2026 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -633,6 +633,11 @@ handle_reserve (void *cls, const struct ReserveMessage *msg) e->amount = amount; e->entries = entries; e->rid = ++reservation_gen; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Reserve space for %u entries with up to %lu bytes under rid %u\n", + entries, + amount, + e->rid); if (reservation_gen < 0) reservation_gen = 0; /* wrap around */ transmit_status (client, e->rid, NULL); @@ -803,6 +808,10 @@ handle_put (void *cls, const struct DataMessage *dm) (uint32_t) ntohl (dm->type)); rid = ntohl (dm->rid); size = ntohl (dm->size); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Put entry into space with %u bytes under rid %u\n", + size, + rid); if (rid > 0) { pos = reservations; @@ -828,7 +837,7 @@ handle_put (void *cls, const struct DataMessage *dm) plugin->api->put (plugin->api->cls, &dm->key, absent, - ntohl (dm->size), + size, &dm[1], ntohl (dm->type), ntohl (dm->priority), @@ -1609,7 +1618,7 @@ run (void *cls, * Define "main" method using service macro. */ GNUNET_SERVICE_MAIN ( - GNUNET_OS_project_data_gnunet(), + GNUNET_OS_project_data_gnunet (), "datastore", GNUNET_SERVICE_OPTION_NONE, &run, diff --git a/src/service/fs/fs_publish.c b/src/service/fs/fs_publish.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2009, 2010 GNUnet e.V. + Copyright (C) 2009-2010, 2026 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -832,7 +832,8 @@ hash_for_index_cb (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ( - "Can not index file `%s': %s. Will try to insert instead.\n"), + "Can not index file `%s': %s. Will try to insert instead.\n") + , p->filename, _ ("failed to compute hash")); p->data.file.do_index = GNUNET_NO; @@ -884,7 +885,8 @@ hash_for_index_cb (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ( - "Can not index file `%s': %s. Will try to insert instead.\n"), + "Can not index file `%s': %s. Will try to insert instead.\n") + , p->filename, _ ("could not connect to `fs' service")); p->data.file.do_index = GNUNET_NO; @@ -1214,10 +1216,11 @@ fip_signal_start (void *cls, "Starting publish operation\n"); if (*do_index) { + uint64_t dblocks = ((length + DBLOCK_SIZE - 1) / DBLOCK_SIZE); /* space for on-demand blocks */ - pc->reserve_space += - ((length + DBLOCK_SIZE - - 1) / DBLOCK_SIZE) * sizeof(struct OnDemandBlock); + if (0 == dblocks) + dblocks++; + pc->reserve_space += dblocks * sizeof(struct OnDemandBlock); } else {