aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_room.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_room.c')
-rw-r--r--src/messenger/gnunet-service-messenger_room.c289
1 files changed, 132 insertions, 157 deletions
diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c
index 4b734cb40..4bb194d01 100644
--- a/src/messenger/gnunet-service-messenger_room.c
+++ b/src/messenger/gnunet-service-messenger_room.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2020--2022 GNUnet e.V. 3 Copyright (C) 2020--2023 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -27,7 +27,7 @@
27#include "gnunet-service-messenger_room.h" 27#include "gnunet-service-messenger_room.h"
28 28
29#include "gnunet-service-messenger_member.h" 29#include "gnunet-service-messenger_member.h"
30#include "gnunet-service-messenger_member_session.h" 30#include "gnunet-service-messenger_sender_session.h"
31 31
32#include "gnunet-service-messenger_message_kind.h" 32#include "gnunet-service-messenger_message_kind.h"
33#include "gnunet-service-messenger_message_handle.h" 33#include "gnunet-service-messenger_message_handle.h"
@@ -38,6 +38,8 @@
38#include "gnunet-service-messenger.h" 38#include "gnunet-service-messenger.h"
39#include "gnunet-service-messenger_service.h" 39#include "gnunet-service-messenger_service.h"
40#include "gnunet-service-messenger_tunnel.h" 40#include "gnunet-service-messenger_tunnel.h"
41
42#include "messenger_api_message.h"
41#include "messenger_api_util.h" 43#include "messenger_api_util.h"
42 44
43static void 45static void
@@ -59,9 +61,10 @@ create_srv_room (struct GNUNET_MESSENGER_SrvHandle *handle,
59 61
60 room->tunnels = GNUNET_CONTAINER_multipeermap_create (8, GNUNET_NO); 62 room->tunnels = GNUNET_CONTAINER_multipeermap_create (8, GNUNET_NO);
61 63
62 init_member_store(get_srv_room_member_store(room), room); 64 init_peer_store (get_srv_room_peer_store (room));
63 init_message_store (get_srv_room_message_store(room)); 65 init_member_store (get_srv_room_member_store (room), room);
64 init_operation_store(get_srv_room_operation_store(room), room); 66 init_message_store (get_srv_room_message_store (room));
67 init_operation_store (get_srv_room_operation_store (room), room);
65 68
66 init_list_tunnels (&(room->basement)); 69 init_list_tunnels (&(room->basement));
67 init_message_state(&(room->state)); 70 init_message_state(&(room->state));
@@ -119,18 +122,27 @@ destroy_srv_room (struct GNUNET_MESSENGER_SrvRoom *room,
119 save_srv_room (room); 122 save_srv_room (room);
120 123
121skip_saving: 124skip_saving:
122 clear_member_store (get_srv_room_member_store(room)); 125 clear_peer_store (get_srv_room_peer_store (room));
123 clear_message_store (get_srv_room_message_store(room)); 126 clear_member_store (get_srv_room_member_store (room));
124 clear_operation_store(get_srv_room_operation_store(room)); 127 clear_message_store (get_srv_room_message_store (room));
128 clear_operation_store (get_srv_room_operation_store (room));
125 129
126 GNUNET_CONTAINER_multipeermap_destroy (room->tunnels); 130 GNUNET_CONTAINER_multipeermap_destroy (room->tunnels);
127 clear_list_tunnels (&(room->basement)); 131 clear_list_tunnels (&(room->basement));
128 clear_message_state(&(room->state)); 132 clear_message_state (&(room->state));
129 133
130 if (room->peer_message) 134 if (room->peer_message)
131 GNUNET_free(room->peer_message); 135 GNUNET_free (room->peer_message);
136
137 GNUNET_free (room);
138}
139
140struct GNUNET_MESSENGER_PeerStore*
141get_srv_room_peer_store (struct GNUNET_MESSENGER_SrvRoom *room)
142{
143 GNUNET_assert(room);
132 144
133 GNUNET_free(room); 145 return &(room->peer_store);
134} 146}
135 147
136struct GNUNET_MESSENGER_MemberStore* 148struct GNUNET_MESSENGER_MemberStore*
@@ -165,7 +177,7 @@ send_room_info (struct GNUNET_MESSENGER_SrvRoom *room,
165 if ((!handle) || (!is_tunnel_connected (tunnel))) 177 if ((!handle) || (!is_tunnel_connected (tunnel)))
166 return GNUNET_NO; 178 return GNUNET_NO;
167 179
168 return send_tunnel_message (tunnel, handle, create_message_info (get_srv_handle_ego (handle))); 180 return send_tunnel_message (tunnel, handle, create_message_info (room->service));
169} 181}
170 182
171static void* 183static void*
@@ -222,73 +234,7 @@ join_room (struct GNUNET_MESSENGER_SrvRoom *room,
222 if (GNUNET_OK != change_srv_handle_member_id (handle, get_srv_room_key(room), member_id)) 234 if (GNUNET_OK != change_srv_handle_member_id (handle, get_srv_room_key(room), member_id))
223 return GNUNET_NO; 235 return GNUNET_NO;
224 236
225 struct GNUNET_MESSENGER_Message *message = create_message_join (get_srv_handle_ego (handle)); 237 notify_srv_handle_member_id (handle, room, member_id, GNUNET_YES);
226
227 if (!message)
228 {
229 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Your join message could not be created!\n");
230
231 return GNUNET_NO;
232 }
233
234 GNUNET_memcpy(&(message->header.sender_id), member_id, sizeof(*member_id));
235 return send_srv_room_message (room, handle, message);
236}
237
238struct GNUNET_MESSENGER_MemberNotify
239{
240 struct GNUNET_MESSENGER_SrvRoom *room;
241 struct GNUNET_MESSENGER_SrvHandle *handle;
242 struct GNUNET_MESSENGER_MemberSession *session;
243};
244
245static void
246notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify,
247 struct GNUNET_MESSENGER_MemberSession *session,
248 struct GNUNET_CONTAINER_MultiHashMap *map,
249 int check_permission)
250{
251 if (session->prev)
252 notify_about_members (notify, session->prev, map, GNUNET_YES);
253
254 struct GNUNET_MESSENGER_MessageStore *message_store = get_srv_room_message_store(notify->room);
255 struct GNUNET_MESSENGER_ListMessage *element;
256
257 for (element = session->messages.head; element; element = element->next)
258 {
259 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(map, &(element->hash)))
260 continue;
261
262 if ((GNUNET_YES == check_permission) &&
263 (GNUNET_YES != check_member_session_history(notify->session, &(element->hash), GNUNET_NO)))
264 continue;
265
266 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(map, &(element->hash), NULL,
267 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
268 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Notification of session message could be duplicated!\n");
269
270 const struct GNUNET_MESSENGER_Message *message = get_store_message(message_store, &(element->hash));
271
272 if (message)
273 notify_srv_handle_message (notify->handle, notify->room, session, message, &(element->hash));
274 }
275}
276
277static int
278iterate_notify_about_members (void *cls,
279 const struct GNUNET_IDENTITY_PublicKey *public_key,
280 struct GNUNET_MESSENGER_MemberSession *session)
281{
282 struct GNUNET_MESSENGER_MemberNotify *notify = cls;
283
284 if ((notify->session == session) || (GNUNET_YES == is_member_session_completed(session)))
285 return GNUNET_YES;
286
287 struct GNUNET_CONTAINER_MultiHashMap *map = GNUNET_CONTAINER_multihashmap_create(4, GNUNET_NO);
288
289 notify_about_members (notify, session, map, GNUNET_NO);
290
291 GNUNET_CONTAINER_multihashmap_destroy(map);
292 return GNUNET_YES; 238 return GNUNET_YES;
293} 239}
294 240
@@ -304,23 +250,6 @@ join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room,
304 if (GNUNET_NO == join_room (room, handle, member)) 250 if (GNUNET_NO == join_room (room, handle, member))
305 return GNUNET_NO; 251 return GNUNET_NO;
306 252
307 const struct GNUNET_MESSENGER_Ego *ego = get_srv_handle_ego(handle);
308 struct GNUNET_MESSENGER_MemberSession *session = get_member_session (member, &(ego->pub));
309
310 if (!session)
311 {
312 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "A valid session is required to join a room!\n");
313 return GNUNET_NO;
314 }
315
316 struct GNUNET_MESSENGER_MemberNotify notify;
317
318 notify.room = room;
319 notify.handle = handle;
320 notify.session = session;
321
322 iterate_store_members(get_srv_room_member_store(room), iterate_notify_about_members, &notify);
323
324 return GNUNET_YES; 253 return GNUNET_YES;
325} 254}
326 255
@@ -379,9 +308,10 @@ open_srv_room (struct GNUNET_MESSENGER_SrvRoom *room,
379 return GNUNET_NO; 308 return GNUNET_NO;
380 } 309 }
381 310
382 struct GNUNET_MESSENGER_Message *peer_msg = create_message_peer (room->service); 311 if (!room->port)
383 GNUNET_memcpy(&(peer_msg->header.sender_id), member_id, sizeof(*member_id)); 312 return GNUNET_NO;
384 return (room->port ? send_srv_room_message (room, handle, peer_msg) : GNUNET_NO); 313
314 return send_srv_room_message (room, handle, create_message_peer (room->service));
385} 315}
386 316
387int 317int
@@ -423,6 +353,20 @@ enter_srv_room_at (struct GNUNET_MESSENGER_SrvRoom *room,
423 return join_room_locally (room, handle); 353 return join_room_locally (room, handle);
424} 354}
425 355
356static void
357sign_srv_room_message_by_peer (const void *cls,
358 struct GNUNET_MESSENGER_Message *message,
359 uint16_t length,
360 char *buffer,
361 const struct GNUNET_HashCode *hash)
362{
363 const struct GNUNET_MESSENGER_SrvHandle *handle = cls;
364
365 GNUNET_assert((handle) && (handle->service));
366
367 sign_message_by_peer(message, length, buffer, hash, handle->service->config);
368}
369
426struct GNUNET_MQ_Envelope* 370struct GNUNET_MQ_Envelope*
427pack_srv_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, 371pack_srv_room_message (const struct GNUNET_MESSENGER_SrvRoom *room,
428 const struct GNUNET_MESSENGER_SrvHandle *handle, 372 const struct GNUNET_MESSENGER_SrvHandle *handle,
@@ -432,16 +376,23 @@ pack_srv_room_message (const struct GNUNET_MESSENGER_SrvRoom *room,
432{ 376{
433 GNUNET_assert((room) && (handle) && (message) && (hash)); 377 GNUNET_assert((room) && (handle) && (message) && (hash));
434 378
435 message->header.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 379 if (GNUNET_YES != is_peer_message(message))
380 return pack_message (message, hash, NULL, mode, NULL);
436 381
437 const struct GNUNET_ShortHashCode *id = get_srv_handle_member_id (handle, get_srv_room_key(room)); 382 message->header.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
438 383
439 GNUNET_assert(id); 384 struct GNUNET_PeerIdentity peer;
385 if (GNUNET_OK != get_service_peer_identity(handle->service, &peer))
386 return NULL;
440 387
441 GNUNET_memcpy(&(message->header.sender_id), id, sizeof(struct GNUNET_ShortHashCode)); 388 convert_peer_identity_to_id(&peer, &(message->header.sender_id));
442 get_message_state_chain_hash (&(room->state), &(message->header.previous)); 389 get_message_state_chain_hash (&(room->state), &(message->header.previous));
443 390
444 return pack_message (message, hash, get_srv_handle_ego (handle), mode); 391 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Packing message with peer signature: %s\n",
392 GNUNET_sh2s (&(message->header.sender_id)));
393
394 message->header.signature.type = htonl (GNUNET_IDENTITY_TYPE_EDDSA);
395 return pack_message (message, hash, sign_srv_room_message_by_peer, mode, handle);
445} 396}
446 397
447struct GNUNET_MESSENGER_ClosureSendRoom 398struct GNUNET_MESSENGER_ClosureSendRoom
@@ -481,7 +432,7 @@ iterate_send_room_message (void *cls,
481 closure->packed = GNUNET_YES; 432 closure->packed = GNUNET_YES;
482 } 433 }
483 else 434 else
484 env = pack_message (closure->message, NULL, NULL, GNUNET_MESSENGER_PACK_MODE_ENVELOPE); 435 env = pack_message(closure->message, NULL, NULL, GNUNET_MESSENGER_PACK_MODE_ENVELOPE, NULL);
485 436
486 if (env) 437 if (env)
487 send_tunnel_envelope (tunnel, env, closure->hash); 438 send_tunnel_envelope (tunnel, env, closure->hash);
@@ -496,7 +447,6 @@ update_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
496 447
497void 448void
498callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, 449callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
499 struct GNUNET_MESSENGER_SrvHandle *handle,
500 const struct GNUNET_MESSENGER_Message *message, 450 const struct GNUNET_MESSENGER_Message *message,
501 const struct GNUNET_HashCode *hash); 451 const struct GNUNET_HashCode *hash);
502 452
@@ -513,8 +463,10 @@ send_srv_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
513 if (GNUNET_YES == is_message_session_bound(message)) 463 if (GNUNET_YES == is_message_session_bound(message))
514 merge_srv_room_last_messages(room, handle); 464 merge_srv_room_last_messages(room, handle);
515 465
516 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Sending message from handle with member id: %s\n", 466
517 GNUNET_sh2s(get_srv_handle_member_id(handle, get_srv_room_key(room)))); 467 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message from handle in room: %s (%s)\n",
468 GNUNET_h2s (&(room->key)),
469 GNUNET_MESSENGER_name_of_kind (message->header.kind));
518 470
519 struct GNUNET_HashCode hash; 471 struct GNUNET_HashCode hash;
520 struct GNUNET_MESSENGER_ClosureSendRoom closure; 472 struct GNUNET_MESSENGER_ClosureSendRoom closure;
@@ -541,6 +493,9 @@ send_srv_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
541 case GNUNET_MESSENGER_KIND_JOIN: 493 case GNUNET_MESSENGER_KIND_JOIN:
542 send_message_join (room, handle, message, &hash); 494 send_message_join (room, handle, message, &hash);
543 break; 495 break;
496 case GNUNET_MESSENGER_KIND_KEY:
497 send_message_key (room, handle, message, &hash);
498 break;
544 case GNUNET_MESSENGER_KIND_PEER: 499 case GNUNET_MESSENGER_KIND_PEER:
545 send_message_peer (room, handle, message, &hash); 500 send_message_peer (room, handle, message, &hash);
546 break; 501 break;
@@ -554,7 +509,7 @@ send_srv_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
554 break; 509 break;
555 } 510 }
556 511
557 callback_room_handle_message (room, handle, message, &hash); 512 callback_room_handle_message (room, message, &hash);
558 return GNUNET_YES; 513 return GNUNET_YES;
559} 514}
560 515
@@ -602,23 +557,6 @@ check_srv_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room,
602 return; 557 return;
603 } 558 }
604 559
605 struct GNUNET_MESSENGER_MemberStore *member_store = get_srv_room_member_store(room);
606 struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message);
607
608 if (!member)
609 goto resend_peer_message;
610
611 struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, room->peer_message);
612
613 if (GNUNET_YES == is_member_session_closed(session))
614 goto resend_peer_message;
615
616 if (tunnel)
617 forward_tunnel_message(tunnel, message, room->peer_message);
618
619 return;
620
621resend_peer_message:
622 if (room->host) 560 if (room->host)
623 send_srv_room_message (room, room->host, create_message_peer (room->service)); 561 send_srv_room_message (room, room->host, create_message_peer (room->service));
624} 562}
@@ -887,15 +825,19 @@ solve_srv_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
887 struct GNUNET_MESSENGER_ListHandles *handles = &(room->service->handles); 825 struct GNUNET_MESSENGER_ListHandles *handles = &(room->service->handles);
888 struct GNUNET_MESSENGER_ListHandle* element; 826 struct GNUNET_MESSENGER_ListHandle* element;
889 827
828 const struct GNUNET_IDENTITY_PublicKey *pubkey;
829
890 for (element = handles->head; element; element = element->next) 830 for (element = handles->head; element; element = element->next)
891 { 831 {
892 if (0 != GNUNET_memcmp(member_id, get_srv_handle_member_id(element->handle, get_srv_room_key(room)))) 832 if (0 != GNUNET_memcmp(member_id, get_srv_handle_member_id(element->handle, get_srv_room_key(room))))
893 continue; 833 continue;
894 834
895 if (0 == GNUNET_memcmp(public_key, &(get_srv_handle_ego(element->handle)->pub))) 835 pubkey = get_srv_handle_key(element->handle);
836
837 if (0 == GNUNET_memcmp(public_key, pubkey))
896 continue; 838 continue;
897 839
898 struct GNUNET_MESSENGER_MemberSession *session = get_member_session(member, &(get_srv_handle_ego(element->handle)->pub)); 840 struct GNUNET_MESSENGER_MemberSession *session = get_member_session(member, pubkey);
899 841
900 if (!session) 842 if (!session)
901 continue; 843 continue;
@@ -908,7 +850,7 @@ solve_srv_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
908 struct GNUNET_ShortHashCode random_id; 850 struct GNUNET_ShortHashCode random_id;
909 generate_free_member_id (&random_id, member_store->members); 851 generate_free_member_id (&random_id, member_store->members);
910 852
911 send_srv_room_message(room, element->handle, create_message_id(&random_id)); 853 notify_srv_handle_member_id (element->handle, room, &random_id, GNUNET_NO);
912 } 854 }
913} 855}
914 856
@@ -962,8 +904,9 @@ rebuild_srv_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room)
962static void 904static void
963handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room) 905handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room)
964{ 906{
965 struct GNUNET_MESSENGER_MessageStore *message_store = get_srv_room_message_store(room); 907 struct GNUNET_MESSENGER_MessageStore *message_store = get_srv_room_message_store (room);
966 struct GNUNET_MESSENGER_MemberStore *member_store = get_srv_room_member_store(room); 908 struct GNUNET_MESSENGER_MemberStore *member_store = get_srv_room_member_store (room);
909 struct GNUNET_MESSENGER_PeerStore *peer_store = get_srv_room_peer_store (room);
967 910
968 while (room->handling.head) 911 while (room->handling.head)
969 { 912 {
@@ -974,15 +917,29 @@ handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room)
974 if (!message) 917 if (!message)
975 goto finish_handling; 918 goto finish_handling;
976 919
977 struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); 920 struct GNUNET_MESSENGER_SenderSession session;
978 921
979 if (!member) 922 if (GNUNET_YES == is_peer_message (message))
980 goto finish_handling; 923 {
924 session.peer = get_store_peer_of (peer_store, message, &(element->hash));
981 925
982 struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, &(element->hash)); 926 if (!session.peer)
927 goto finish_handling;
928 }
929 else
930 {
931 struct GNUNET_MESSENGER_Member *member = get_store_member_of (member_store, message);
983 932
984 if (session) 933 if (!member)
985 handle_service_message (room->service, room, session, message, &(element->hash)); 934 goto finish_handling;
935
936 session.member = get_member_session_of (member, message, &(element->hash));
937
938 if (!session.member)
939 goto finish_handling;
940 }
941
942 handle_service_message (room->service, room, &session, message, &(element->hash));
986 943
987finish_handling: 944finish_handling:
988 GNUNET_CONTAINER_DLL_remove(room->handling.head, room->handling.tail, element); 945 GNUNET_CONTAINER_DLL_remove(room->handling.head, room->handling.tail, element);
@@ -1084,27 +1041,45 @@ remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room,
1084 1041
1085void 1042void
1086callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, 1043callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
1087 struct GNUNET_MESSENGER_SrvHandle *handle,
1088 const struct GNUNET_MESSENGER_Message *message, 1044 const struct GNUNET_MESSENGER_Message *message,
1089 const struct GNUNET_HashCode *hash) 1045 const struct GNUNET_HashCode *hash)
1090{ 1046{
1091 struct GNUNET_MESSENGER_MemberStore *member_store = get_srv_room_member_store(room); 1047 GNUNET_assert((room) && (message) && (hash));
1092 struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message);
1093 1048
1094 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Callback for message (%s)\n", GNUNET_h2s (hash)); 1049 struct GNUNET_MESSENGER_PeerStore *peer_store = get_srv_room_peer_store (room);
1050 struct GNUNET_MESSENGER_MemberStore *member_store = get_srv_room_member_store (room);
1095 1051
1096 if (!member) 1052 struct GNUNET_MESSENGER_SenderSession session;
1053
1054 if (GNUNET_YES == is_peer_message (message))
1097 { 1055 {
1098 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Message handling dropped: Member is missing!\n"); 1056 session.peer = get_store_peer_of (peer_store, message, hash);
1099 return; 1057
1058 if (!session.peer)
1059 {
1060 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Message handling dropped: Peer is missing!\n");
1061 return;
1062 }
1100 } 1063 }
1064 else
1065 {
1066 struct GNUNET_MESSENGER_Member *member = get_store_member_of (member_store, message);
1101 1067
1102 struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, hash); 1068 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Callback for message (%s)\n", GNUNET_h2s (hash));
1103 1069
1104 if (!session) 1070 if (!member)
1105 { 1071 {
1106 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Message handling dropped: Session is missing!\n"); 1072 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Message handling dropped: Member is missing!\n");
1107 return; 1073 return;
1074 }
1075
1076 session.member = get_member_session_of (member, message, hash);
1077
1078 if (!session.member)
1079 {
1080 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Message handling dropped: Session is missing!\n");
1081 return;
1082 }
1108 } 1083 }
1109 1084
1110 struct GNUNET_MESSENGER_MemberUpdate update; 1085 struct GNUNET_MESSENGER_MemberUpdate update;
@@ -1133,28 +1108,28 @@ callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
1133 switch (message->header.kind) 1108 switch (message->header.kind)
1134 { 1109 {
1135 case GNUNET_MESSENGER_KIND_JOIN: 1110 case GNUNET_MESSENGER_KIND_JOIN:
1136 handle_message_join (room, session, message, hash); 1111 handle_message_join (room, &session, message, hash);
1137 break; 1112 break;
1138 case GNUNET_MESSENGER_KIND_LEAVE: 1113 case GNUNET_MESSENGER_KIND_LEAVE:
1139 handle_message_leave (room, session, message, hash); 1114 handle_message_leave (room, &session, message, hash);
1140 break; 1115 break;
1141 case GNUNET_MESSENGER_KIND_NAME: 1116 case GNUNET_MESSENGER_KIND_NAME:
1142 handle_message_name (room, session, message, hash); 1117 handle_message_name (room, &session, message, hash);
1143 break; 1118 break;
1144 case GNUNET_MESSENGER_KIND_KEY: 1119 case GNUNET_MESSENGER_KIND_KEY:
1145 handle_message_key (room, session, message, hash); 1120 handle_message_key (room, &session, message, hash);
1146 break; 1121 break;
1147 case GNUNET_MESSENGER_KIND_PEER: 1122 case GNUNET_MESSENGER_KIND_PEER:
1148 handle_message_peer (room, session, message, hash); 1123 handle_message_peer (room, &session, message, hash);
1149 break; 1124 break;
1150 case GNUNET_MESSENGER_KIND_ID: 1125 case GNUNET_MESSENGER_KIND_ID:
1151 handle_message_id (room, session, message, hash); 1126 handle_message_id (room, &session, message, hash);
1152 break; 1127 break;
1153 case GNUNET_MESSENGER_KIND_MISS: 1128 case GNUNET_MESSENGER_KIND_MISS:
1154 handle_message_miss (room, session, message, hash); 1129 handle_message_miss (room, &session, message, hash);
1155 break; 1130 break;
1156 case GNUNET_MESSENGER_KIND_DELETE: 1131 case GNUNET_MESSENGER_KIND_DELETE:
1157 handle_message_delete (room, session, message, hash); 1132 handle_message_delete (room, &session, message, hash);
1158 break; 1133 break;
1159 default: 1134 default:
1160 break; 1135 break;