commit 26a34be94f6399d28d562b819aebe5381639c086
parent 89dbcd1655cb8e7951c22104d744d2469a642fa4
Author: Jacki <jacki@thejackimonster.de>
Date: Mon, 14 Jul 2025 20:42:12 +0200
Safeguard automatic requests in context
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/gnunet_chat_context.c b/src/gnunet_chat_context.c
@@ -193,6 +193,9 @@ context_request_message (struct GNUNET_CHAT_Context* context,
{
GNUNET_assert((context) && (hash));
+ if ((!(context->room)) || (GNUNET_YES == context->deleted))
+ return;
+
if ((GNUNET_is_zero(hash)) ||
(GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(context->messages, hash)))
return;
@@ -569,5 +572,11 @@ context_delete (struct GNUNET_CHAT_Context *context,
if (GNUNET_YES != exit)
return;
+ if (context->request_task)
+ {
+ GNUNET_SCHEDULER_cancel(context->request_task);
+ context->request_task = NULL;
+ }
+
GNUNET_MESSENGER_close_room(context->room);
}
diff --git a/src/gnunet_chat_context_intern.c b/src/gnunet_chat_context_intern.c
@@ -124,7 +124,7 @@ cb_context_request_messages (void *cls)
context->request_task = NULL;
- if (!(context->room))
+ if ((!(context->room)) || (GNUNET_YES == context->deleted))
return;
GNUNET_CONTAINER_multihashmap_iterate(
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c
@@ -1051,6 +1051,9 @@ on_handle_message (void *cls,
handle->contexts, GNUNET_MESSENGER_room_get_key(room)
);
+ if ((! context) || (GNUNET_YES == context->deleted))
+ return;
+
if (GNUNET_MESSENGER_KIND_MERGE == msg->header.kind)
context_request_message(context, &(msg->body.merge.previous));
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -1665,7 +1665,7 @@ GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context)
handle->contexts, &(key.hash), context,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
{
- GNUNET_MESSENGER_close_room(room);
+ context_update_room(context, NULL, GNUNET_YES);
return GNUNET_SYSERR;
}