summaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_room.c
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-03-06 19:03:05 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2021-03-06 19:03:05 +0100
commit9ae422a2a86c3a8199b3fcb4a64ab475274b3450 (patch)
tree46eea216b0ed284f5c058213f2a2733b366af4b3 /src/messenger/gnunet-service-messenger_room.c
parent2925310d67483aca6e055e1ce0593c6463cd6c72 (diff)
-fix for messengers session-chain
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/messenger/gnunet-service-messenger_room.c')
-rw-r--r--src/messenger/gnunet-service-messenger_room.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c
index e0bec7991..027df682c 100644
--- a/src/messenger/gnunet-service-messenger_room.c
+++ b/src/messenger/gnunet-service-messenger_room.c
@@ -939,6 +939,9 @@ iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKe
return GNUNET_YES;
}
+static void
+remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session);
+
void
callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
@@ -975,7 +978,7 @@ callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUN
{
struct GNUNET_MESSENGER_MemberSessionCompletion *element = update.head;
- remove_member_session (element->session->member, element->session);
+ remove_room_member_session (room, element->session);
GNUNET_CONTAINER_DLL_remove(update.head, update.tail, element);
GNUNET_free (element);
@@ -1087,3 +1090,35 @@ save_room (struct GNUNET_MESSENGER_SrvRoom *room)
GNUNET_free(room_dir);
}
+
+static void
+remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session)
+{
+ GNUNET_assert ((room) && (session));
+
+ remove_member_session (session->member, session);
+
+ const struct GNUNET_IDENTITY_PublicKey *public_key = get_member_session_public_key(session);
+
+ struct GNUNET_HashCode hash;
+ GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash);
+
+ char *room_dir;
+ get_room_data_subdir (room, &room_dir);
+
+ char* session_dir;
+ GNUNET_asprintf (
+ &session_dir, "%s%s%c%s%c%s%c%s%c", room_dir,
+ "members", DIR_SEPARATOR,
+ GNUNET_sh2s(get_member_session_id(session)), DIR_SEPARATOR,
+ "sessions", DIR_SEPARATOR,
+ GNUNET_h2s(&hash), DIR_SEPARATOR
+ );
+
+ GNUNET_free (room_dir);
+
+ GNUNET_DISK_directory_remove(session_dir);
+ GNUNET_free (session_dir);
+
+ destroy_member_session(session);
+}