gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: MESSENGER: Cleanup circular dependency i


From: gnunet
Subject: [gnunet] branch master updated: MESSENGER: Cleanup circular dependency in linked deletion
Date: Mon, 19 Feb 2024 15:25:07 +0100

This is an automated email from the git hooks/post-receive script.

thejackimonster pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new e574399be MESSENGER: Cleanup circular dependency in linked deletion
e574399be is described below

commit e574399beb219aa9465ed23f36b494bc4e332fcd
Author: TheJackiMonster <thejackimonster@gmail.com>
AuthorDate: Mon Feb 19 15:24:52 2024 +0100

    MESSENGER: Cleanup circular dependency in linked deletion
    
    Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
---
 src/service/messenger/messenger_api_room.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/service/messenger/messenger_api_room.c 
b/src/service/messenger/messenger_api_room.c
index 5a9c719f8..715934f1c 100644
--- a/src/service/messenger/messenger_api_room.c
+++ b/src/service/messenger/messenger_api_room.c
@@ -830,6 +830,22 @@ struct GNUNET_MESSENGER_RoomLinkDeletionInfo
 };
 
 
+static enum GNUNET_GenericReturnValue
+clear_linked_hash (void *cls,
+                   const struct GNUNET_HashCode *key,
+                   void *value)
+{
+  struct GNUNET_HashCode **linked = cls;
+  struct GNUNET_HashCode *hash = value;
+
+  if (0 != GNUNET_CRYPTO_hash_cmp (*linked, hash))
+    return GNUNET_YES;
+
+  *linked = hash;
+  return GNUNET_NO;
+}
+
+
 static enum GNUNET_GenericReturnValue
 delete_linked_hash (void *cls,
                     const struct GNUNET_HashCode *key,
@@ -838,6 +854,19 @@ delete_linked_hash (void *cls,
   struct GNUNET_MESSENGER_RoomLinkDeletionInfo *info = cls;
   struct GNUNET_HashCode *hash = value;
 
+  struct GNUNET_HashCode key_value;
+  GNUNET_memcpy (&key_value, key, sizeof (key_value));
+
+  struct GNUNET_HashCode *linked = &key_value;
+
+  GNUNET_CONTAINER_multihashmap_get_multiple (info->room->links, hash,
+                                              clear_linked_hash, &linked);
+
+  if ((linked != &key_value) &&
+      (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (info->room->links,
+                                                           hash, linked)))
+    GNUNET_free (linked);
+
   if (info->deletion)
     info->deletion (info->room, hash, info->delay);
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]