2 This file is part of GNUnet.
3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file core/gnunet-service-core_sessions.c
23 * @brief code for managing of 'encrypted' sessions (key exchange done)
24 * @author Christian Grothoff
27 #include "gnunet-service-core.h"
28 #include "gnunet-service-core_neighbours.h"
29 #include "gnunet-service-core_kx.h"
30 #include "gnunet-service-core_typemap.h"
31 #include "gnunet-service-core_sessions.h"
32 #include "gnunet-service-core_clients.h"
33 #include "gnunet_constants.h"
37 * Message ready for encryption. This struct is followed by the
38 * actual content of the message.
40 struct SessionMessageEntry
44 * We keep messages in a doubly linked list.
46 struct SessionMessageEntry *next;
49 * We keep messages in a doubly linked list.
51 struct SessionMessageEntry *prev;
54 * Deadline for transmission, 1s after we received it (if we
55 * are not corking), otherwise "now". Note that this message
56 * does NOT expire past its deadline.
58 struct GNUNET_TIME_Absolute deadline;
61 * How long is the message? (number of bytes following the "struct
62 * MessageEntry", but not including the size of "struct
63 * MessageEntry" itself!)
71 * Data kept per session.
76 * Identity of the other peer.
78 struct GNUNET_PeerIdentity peer;
81 * Head of list of requests from clients for transmission to
84 struct GSC_ClientActiveRequest *active_client_request_head;
87 * Tail of list of requests from clients for transmission to
90 struct GSC_ClientActiveRequest *active_client_request_tail;
93 * Head of list of messages ready for encryption.
95 struct SessionMessageEntry *sme_head;
98 * Tail of list of messages ready for encryption.
100 struct SessionMessageEntry *sme_tail;
103 * Information about the key exchange with the other peer.
105 struct GSC_KeyExchangeInfo *kxinfo;
108 * Current type map for this peer.
110 struct GSC_TypeMap *tmap;
113 * At what time did we initially establish this session?
114 * (currently unused, should be integrated with ATS in the
117 struct GNUNET_TIME_Absolute time_established;
120 * Task to transmit corked messages with a delay.
122 GNUNET_SCHEDULER_TaskIdentifier cork_task;
125 * Tracking bandwidth for sending to this peer.
126 * // FIXME: unused! should it be used?
128 struct GNUNET_BANDWIDTH_Tracker available_send_window;
131 * Tracking bandwidth for receiving from this peer.
132 * // FIXME: need to set it!
134 struct GNUNET_BANDWIDTH_Tracker available_recv_window;
137 * Available bandwidth out for this peer (current target).
138 * // FIXME: check usage!
140 struct GNUNET_BANDWIDTH_Value32NBO bw_out;
143 * Internal bandwidth limit set for this peer (initially typically
144 * set to "-1"). Actual "bw_out" is MIN of
145 * "bpm_out_internal_limit" and "bw_out_external_limit".
146 * // FIXME: check usage
148 struct GNUNET_BANDWIDTH_Value32NBO bw_out_internal_limit;
151 * External bandwidth limit set for this peer by the
152 * peer that we are communicating with. "bw_out" is MIN of
153 * "bw_out_internal_limit" and "bw_out_external_limit".
154 * // FIXME: check usage
156 struct GNUNET_BANDWIDTH_Value32NBO bw_out_external_limit;
160 * Is the neighbour queue empty and thus ready for us
161 * to transmit an encrypted message?
163 int ready_to_transmit;
169 * Map of peer identities to 'struct Session'.
171 static struct GNUNET_CONTAINER_MultiHashMap *sessions;
175 * Find the session for the given peer.
177 * @param peer identity of the peer
178 * @return NULL if we are not connected, otherwise the
181 static struct Session *
182 find_session (const struct GNUNET_PeerIdentity *peer)
184 return GNUNET_CONTAINER_multihashmap_get (sessions, &peer->hashPubKey);
189 * End the session with the given peer (we are no longer
192 * @param pid identity of peer to kill session with
195 GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid)
197 struct Session *session;
198 struct GSC_ClientActiveRequest *car;
200 session = find_session (pid);
204 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
205 "Destroying session for peer `%4s'\n",
206 GNUNET_i2s (&session->peer));
208 if (GNUNET_SCHEDULER_NO_TASK != session->cork_task)
210 GNUNET_SCHEDULER_cancel (session->cork_task);
211 session->cork_task = GNUNET_SCHEDULER_NO_TASK;
213 GNUNET_assert (GNUNET_YES ==
214 GNUNET_CONTAINER_multihashmap_remove (sessions,
215 &session->peer.hashPubKey, session));
216 while (NULL != (car = session->active_client_request_head))
218 GNUNET_CONTAINER_DLL_remove (session->active_client_request_head,
219 session->active_client_request_tail,
221 GSC_CLIENTS_reject_request (car);
223 GNUNET_STATISTICS_set (GSC_stats,
224 gettext_noop ("# established sessions"),
225 GNUNET_CONTAINER_multihashmap_size (sessions),
227 GNUNET_free (session);
232 * Create a session, a key exchange was just completed.
234 * @param peer peer that is now connected
235 * @param kx key exchange that completed
238 GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer,
239 struct GSC_KeyExchangeInfo *kx)
241 struct GNUNET_MessageHeader *hdr;
242 struct Session *session;
245 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
246 "Creating session for peer `%4s'\n", GNUNET_i2s (pid));
248 session = GNUNET_malloc (sizeof (struct Session));
249 session->peer = *peer;
250 session->kxinfo = kx;
251 session->time_established = GNUNET_TIME_absolute_get ();
252 GNUNET_assert (GNUNET_OK ==
253 GNUNET_CONTAINER_multihashmap_put (sessions,
254 &peer->hashPubKey, session,
255 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
256 GNUNET_STATISTICS_update (GSC_stats,
257 gettext_noop ("# established sessions"),
258 GNUNET_CONTAINER_multihashmap_size (sessions),
261 /* FIXME: integration with ATS for quota calculations... */
262 /* FIXME: who should do this? Neighbours!? */
263 GNUNET_TRANSPORT_set_quota (transport,
265 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
266 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT);
268 /* FIXME: we should probably do this periodically (in case
269 type map message is lost...) */
270 hdr = GSC_TYPEMAP_compute_type_map_message ();
271 GSC_KX_encrypt_and_transmit (kx,
272 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
280 * Notify the given client about the session (client is new).
282 * @param cls the 'struct GSC_Client'
283 * @param key peer identity
284 * @param value the 'struct Session'
285 * @return GNUNET_OK (continue to iterate)
288 notify_client_about_session (void *cls,
289 const GNUNET_HashCode *key,
292 struct GSC_Client *client = cls;
293 struct Session *session = value;
295 GDS_CLIENTS_notify_client_about_neighbour (client,
297 NULL, 0, /* FIXME: ATS!? */
298 NULL, /* old TMAP: none */
305 * We have a new client, notify it about all current sessions.
307 * @param client the new client
310 GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client)
312 /* notify new client about existing sessions */
313 GNUNET_CONTAINER_multihashmap_iterate (sessions,
314 ¬ify_client_about_session, client);
319 * Try to perform a transmission on the given session. Will solicit
320 * additional messages if the 'sme' queue is not full enough.
322 * @param session session to transmit messages from
325 try_transmission (struct Session *session);
329 * Queue a request from a client for transmission to a particular peer.
331 * @param car request to queue; this handle is then shared between
332 * the caller (CLIENTS subsystem) and SESSIONS and must not
333 * be released by either until either 'GNUNET_SESSIONS_dequeue',
334 * 'GNUNET_SESSIONS_transmit' or 'GNUNET_CLIENTS_failed'
335 * have been invoked on it
338 GSC_SESSIONS_queue_request (struct GSC_ClientActiveRequest *car)
340 struct Session *session;
342 session = find_session (&car->target);
345 /* neighbour must have disconnected since request was issued,
346 * ignore (client will realize it once it processes the
347 * disconnect notification) */
348 #if DEBUG_CORE_CLIENT
349 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
350 "Dropped client request for transmission (am disconnected)\n");
352 GNUNET_STATISTICS_update (GSC_stats,
354 ("# send requests dropped (disconnected)"), 1,
356 GSC_CLIENTS_reject_request (car);
359 if (car->msize > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE)
362 GSC_CLIENTS_reject_request (car);
365 #if DEBUG_CORE_CLIENT
366 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
367 "Received client transmission request. queueing\n");
369 GNUNET_CONTAINER_DLL_insert (session->active_client_request_head,
370 session->active_client_request_tail, car);
371 try_transmission (session);
376 * Dequeue a request from a client from transmission to a particular peer.
378 * @param car request to dequeue; this handle will then be 'owned' by
379 * the caller (CLIENTS sysbsystem)
382 GSC_SESSIONS_dequeue_request (struct GSC_ClientActiveRequest *car)
386 s = find_session (&car->target);
387 GNUNET_CONTAINER_DLL_remove (s->active_client_request_head,
388 s->active_client_request_tail, car);
393 * Discard all expired active transmission requests from clients.
395 * @param session session to clean up
398 discard_expired_requests (struct Session *session)
400 struct GSC_ClientActiveRequest *pos;
401 struct GSC_ClientActiveRequest *nxt;
402 struct GNUNET_TIME_Absolute now;
404 now = GNUNET_TIME_absolute_get ();
406 nxt = session->active_client_request_head;
411 if ( (pos->deadline.abs_value < now.abs_value) &&
412 (GNUNET_YES != pos->was_solicited) )
414 GNUNET_STATISTICS_update (GSC_stats,
416 ("# messages discarded (expired prior to transmission)"),
418 GNUNET_CONTAINER_DLL_remove (session->active_client_request_head,
419 session->active_client_request_tail,
421 GSC_CLIENTS_reject_request (pos);
428 * Solicit messages for transmission.
430 * @param session session to solict messages for
433 solicit_messages (struct Session *session)
435 struct GSC_ClientActiveRequest *car;
438 discard_expired_requests (session);
440 for (car = session->active_client_request_head; NULL != car; car = car->next)
442 if (so_size + car->msize > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE)
444 so_size += car->msize;
445 if (car->was_solicited == GNUNET_YES)
447 car->was_solicited = GNUNET_YES;
448 GSC_CLIENTS_solicit_request (car);
454 * Some messages were delayed (corked), but the timeout has now expired.
457 * @param cls 'struct Session' with the messages to transmit now
458 * @param tc scheduler context (unused)
461 pop_cork_task (void *cls,
462 const struct GNUNET_SCHEDULER_TaskContext *tc)
464 struct Session *session = session;
466 session->cork_task = GNUNET_SCHEDULER_NO_TASK;
467 try_transmission (session);
472 * Try to perform a transmission on the given session. Will solicit
473 * additional messages if the 'sme' queue is not full enough.
475 * @param session session to transmit messages from
478 try_transmission (struct Session *session)
480 struct SessionMessageEntry *pos;
482 struct GNUNET_TIME_Absolute now;
483 struct GNUNET_TIME_Absolute min_deadline;
485 if (GNUNET_YES != session->ready_to_transmit)
488 min_deadline = GNUNET_TIME_UNIT_FOREVER_ABS;
489 /* check 'ready' messages */
490 pos = session->sme_head;
491 GNUNET_assert (pos->size < GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE);
492 while ( (NULL != pos) &&
493 (msize + pos->size <= GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE) )
496 min_deadline = GNUNET_TIME_absolute_min (min_deadline,
500 now = GNUNET_TIME_absolute_get ();
502 ( (msize < GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE / 2) &&
503 (min_deadline.abs_value > now.abs_value) ) )
505 /* not enough ready yet, try to solicit more */
506 solicit_messages (session);
509 /* if there is data to send, just not yet, make sure we do transmit
510 it once the deadline is reached */
511 if (session->cork_task != GNUNET_SCHEDULER_NO_TASK)
512 GNUNET_SCHEDULER_cancel (session->cork_task);
513 session->cork_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (min_deadline),
519 /* create plaintext buffer of all messages, encrypt and transmit */
521 static unsigned long long total_bytes;
522 static unsigned int total_msgs;
523 char pbuf[msize]; /* plaintext */
527 pos = session->sme_head;
528 while ( (NULL != pos) &&
529 (used + pos->size <= msize) )
531 memcpy (&pbuf[used], &pos[1], pos->size);
534 /* compute average payload size */
539 /* 2^32 messages, wrap around... */
543 GNUNET_STATISTICS_set (GSC_stats,
544 "# avg payload per encrypted message",
545 total_bytes / total_msgs,
547 /* now actually transmit... */
548 session->ready_to_transmit = GNUNET_NO;
549 GSC_KX_encrypt_and_transmit (session->kxinfo,
550 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT /* FIXME! */,
558 * Send a message to the neighbour now.
560 * @param cls the message
561 * @param key neighbour's identity
562 * @param value 'struct Neighbour' of the target
563 * @return always GNUNET_OK
566 do_send_message (void *cls, const GNUNET_HashCode * key, void *value)
568 const struct GNUNET_MessageHeader *hdr = cls;
569 struct Session *session = value;
570 struct SessionMessageEntry *m;
573 size = ntohs (hdr->size);
574 m = GNUNET_malloc (sizeof (struct SessionMessageEntry) + size);
575 memcpy (&m[1], hdr, size);
577 GNUNET_CONTAINER_DLL_insert (session->sme_head,
580 try_transmission (session);
586 * Broadcast a message to all neighbours.
588 * @param msg message to transmit
591 GSC_SESSIONS_broadcast (const struct GNUNET_MessageHeader *msg)
593 if (NULL == sessions)
595 GNUNET_CONTAINER_multihashmap_iterate (sessions,
596 &do_send_message, (void*) msg);
601 * Traffic is being solicited for the given peer. This means that the
602 * message queue on the transport-level (NEIGHBOURS subsystem) is now
603 * empty and it is now OK to transmit another (non-control) message.
605 * @param pid identity of peer ready to receive data
608 GSC_SESSIONS_solicit (const struct GNUNET_PeerIdentity *pid)
610 struct Session *session;
612 session = find_session (pid);
613 session->ready_to_transmit = GNUNET_YES;
614 try_transmission (session);
619 * Transmit a message to a particular peer.
621 * @param car original request that was queued and then solicited;
622 * this handle will now be 'owned' by the SESSIONS subsystem
623 * @param msg message to transmit
624 * @param cork is corking allowed?
627 GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
628 const struct GNUNET_MessageHeader *msg,
631 struct Session *session;
632 struct SessionMessageEntry *sme;
635 session = find_session (&car->target);
636 msize = ntohs (msg->size);
637 sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + msize);
638 memcpy (&sme[1], msg, msize);
640 if (GNUNET_YES == cork)
641 sme->deadline = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_MAX_CORK_DELAY);
642 GNUNET_CONTAINER_DLL_insert_tail (session->sme_head,
645 try_transmission (session);
650 * Helper function for GSC_SESSIONS_handle_client_iterate_peers.
652 * @param cls the 'struct GNUNET_SERVER_TransmitContext' to queue replies
653 * @param key identity of the connected peer
654 * @param value the 'struct Neighbour' for the peer
655 * @return GNUNET_OK (continue to iterate)
659 queue_connect_message (void *cls, const GNUNET_HashCode * key, void *value)
661 struct GNUNET_SERVER_TransmitContext *tc = cls;
662 struct Session *session = value;
663 struct ConnectNotifyMessage cnm;
664 struct GNUNET_TRANSPORT_ATS_Information *a;
666 /* FIXME: code duplication with clients... */
667 cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
668 cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
669 cnm.ats_count = htonl (0);
670 cnm.peer = session->peer;
672 // FIXME: full ats...
673 a[0].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
674 a[0].value = htonl (0);
675 GNUNET_SERVER_transmit_context_append_message (tc, &cnm.header);
681 * Handle CORE_ITERATE_PEERS request. For this request type, the client
682 * does not have to have transmitted an INIT request. All current peers
683 * are returned, regardless of which message types they accept.
686 * @param client client sending the iteration request
687 * @param message iteration request message
690 GSC_SESSIONS_handle_client_iterate_peers (void *cls, struct GNUNET_SERVER_Client *client,
691 const struct GNUNET_MessageHeader *message)
693 struct GNUNET_MessageHeader done_msg;
694 struct GNUNET_SERVER_TransmitContext *tc;
696 tc = GNUNET_SERVER_transmit_context_create (client);
697 GNUNET_CONTAINER_multihashmap_iterate (sessions,
698 &queue_connect_message,
700 done_msg.size = htons (sizeof (struct GNUNET_MessageHeader));
701 done_msg.type = htons (GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS_END);
702 GNUNET_SERVER_transmit_context_append_message (tc, &done_msg);
703 GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
708 * Handle CORE_PEER_CONNECTED request. Notify client about connection
709 * to the given neighbour. For this request type, the client does not
710 * have to have transmitted an INIT request. All current peers are
711 * returned, regardless of which message types they accept.
714 * @param client client sending the iteration request
715 * @param message iteration request message
718 GSC_SESSIONS_handle_client_have_peer (void *cls, struct GNUNET_SERVER_Client *client,
719 const struct GNUNET_MessageHeader *message)
721 struct GNUNET_MessageHeader done_msg;
722 struct GNUNET_SERVER_TransmitContext *tc;
723 const struct GNUNET_PeerIdentity *peer;
725 peer = (const struct GNUNET_PeerIdentity *) &message[1]; // YUCK!
726 tc = GNUNET_SERVER_transmit_context_create (client);
727 GNUNET_CONTAINER_multihashmap_get_multiple (sessions, &peer->hashPubKey,
728 &queue_connect_message, tc);
729 done_msg.size = htons (sizeof (struct GNUNET_MessageHeader));
730 done_msg.type = htons (GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS_END);
731 GNUNET_SERVER_transmit_context_append_message (tc, &done_msg);
732 GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
737 * Handle REQUEST_INFO request. For this request type, the client must
738 * have transmitted an INIT first.
741 * @param client client sending the request
742 * @param message iteration request message
745 GSC_SESSIONS_handle_client_request_info (void *cls, struct GNUNET_SERVER_Client *client,
746 const struct GNUNET_MessageHeader *message)
748 const struct RequestInfoMessage *rcm;
749 struct Session *session;
750 struct ConfigurationInfoMessage cim;
753 struct GNUNET_TIME_Relative rdelay;
755 rdelay = GNUNET_TIME_UNIT_ZERO;
756 #if DEBUG_CORE_CLIENT
757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
758 "Core service receives `%s' request.\n",
761 rcm = (const struct RequestInfoMessage *) message;
762 session = find_session (&rcm->peer);
765 /* Technically, this COULD happen (due to asynchronous behavior),
766 * but it should be rare, so we should generate an info event
767 * to help diagnosis of serious errors that might be masked by this */
768 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
769 _("Client asked for preference change with peer `%s', which is not connected!\n"),
770 GNUNET_i2s (&rcm->peer));
771 GNUNET_SERVER_receive_done (client, GNUNET_OK);
775 want_reserv = ntohl (rcm->reserve_inbound);
776 if (session->bw_out_internal_limit.value__ != rcm->limit_outbound.value__)
778 session->bw_out_internal_limit = rcm->limit_outbound;
779 if (session->bw_out.value__ !=
780 GNUNET_BANDWIDTH_value_min (session->bw_out_internal_limit,
781 session->bw_out_external_limit).value__)
784 GNUNET_BANDWIDTH_value_min (session->bw_out_internal_limit,
785 session->bw_out_external_limit);
786 GNUNET_BANDWIDTH_tracker_update_quota (&session->available_recv_window,
789 // FIXME: who does this?
790 GNUNET_TRANSPORT_set_quota (transport, &session->peer,
798 got_reserv = want_reserv;
800 else if (want_reserv > 0)
803 GNUNET_BANDWIDTH_tracker_get_delay (&session->available_recv_window,
805 if (rdelay.rel_value == 0)
806 got_reserv = want_reserv;
808 got_reserv = 0; /* all or nothing */
812 GNUNET_BANDWIDTH_tracker_consume (&session->available_recv_window, got_reserv);
814 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
815 "Received reservation request for %d bytes for peer `%4s', reserved %d bytes, suggesting delay of %llu ms\n",
816 (int) want_reserv, GNUNET_i2s (&rcm->peer), (int) got_reserv,
817 (unsigned long long) rdelay.rel_value);
819 cim.header.size = htons (sizeof (struct ConfigurationInfoMessage));
820 cim.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO);
821 cim.reserved_amount = htonl (got_reserv);
822 cim.reserve_delay = GNUNET_TIME_relative_hton (rdelay);
823 cim.rim_id = rcm->rim_id;
824 cim.bw_out = session->bw_out;
825 cim.preference = 0; /* FIXME: remove */
826 cim.peer = rcm->peer;
827 GSC_CLIENTS_send_to_client (client, &cim.header, GNUNET_NO);
828 GNUNET_SERVER_receive_done (client, GNUNET_OK);
833 * Update information about a session.
835 * @param peer peer who's session should be updated
836 * @param bw_out new outbound bandwidth limit for the peer
837 * @param atsi performance information
838 * @param atsi_count number of performance records supplied
841 GSC_SESSIONS_update (const struct GNUNET_PeerIdentity *peer,
842 struct GNUNET_BANDWIDTH_Value32NBO bw_out)
845 /* not implemented */
850 * Initialize sessions subsystem.
855 sessions = GNUNET_CONTAINER_multihashmap_create (128);
860 * Helper function for GSC_SESSIONS_handle_client_iterate_peers.
863 * @param key identity of the connected peer
864 * @param value the 'struct Session' for the peer
865 * @return GNUNET_OK (continue to iterate)
868 free_session_helper (void *cls, const GNUNET_HashCode * key, void *value)
870 struct Session *session = value;
872 GSC_SESSIONS_end (&session->peer);
878 * Shutdown sessions subsystem.
883 GNUNET_CONTAINER_multihashmap_iterate (sessions,
884 &free_session_helper,
886 GNUNET_CONTAINER_multihashmap_destroy (sessions);
888 GNUNET_STATISTICS_set (GSC_stats,
889 gettext_noop ("# established sessions"),
893 /* end of gnunet-service-core_sessions.c */