libgnunetchat

library for GNUnet Messenger
Log | Files | Refs | README | LICENSE

commit 1ce8e8bddaab6363fdb700454f5ab56992b54a54
parent 127b2f34dc6189c830e013c7c3fec42ae1cc47f1
Author: Jacki <jacki@thejackimonster.de>
Date:   Mon, 22 Apr 2024 18:33:54 +0200

Fix duplicate requested files from uri

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

Diffstat:
Msrc/gnunet_chat_lib.c | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c @@ -792,8 +792,20 @@ GNUNET_CHAT_request_file (struct GNUNET_CHAT_Handle *handle, if (file) return file; + + file = file_create_from_chk_uri(handle, uri->fs.uri); + + if (!file) + return NULL; + + if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(handle->files, hash, file, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) + { + file_destroy(file); + file = NULL; + } - return file_create_from_chk_uri(handle, uri->fs.uri); + return file; }