aboutsummaryrefslogtreecommitdiff
path: root/src/set/gnunet-service-set.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/set/gnunet-service-set.c')
-rw-r--r--src/set/gnunet-service-set.c82
1 files changed, 46 insertions, 36 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 4168685f1..b0f8b2091 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -614,42 +614,6 @@ client_connect_cb (void *cls,
614 614
615 615
616/** 616/**
617 * Clean up after a client has disconnected
618 *
619 * @param cls closure, unused
620 * @param client the client to clean up after
621 * @param internal_cls our client-specific internal data structure
622 */
623static void
624client_disconnect_cb (void *cls,
625 struct GNUNET_SERVICE_Client *client,
626 void *internal_cls)
627{
628 struct Listener *listener;
629 struct Set *set;
630
631 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
632 "client disconnected, cleaning up\n");
633 set = set_get (client);
634 if (NULL != set)
635 {
636 set->client = NULL;
637 set_destroy (set);
638 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
639 "Client's set destroyed\n");
640 }
641 listener = listener_get (client);
642 if (NULL != listener)
643 {
644 listener->client = NULL;
645 listener_destroy (listener);
646 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
647 "Client's listener destroyed\n");
648 }
649}
650
651
652/**
653 * Destroy an incoming request from a remote peer 617 * Destroy an incoming request from a remote peer
654 * 618 *
655 * @param incoming remote request to destroy 619 * @param incoming remote request to destroy
@@ -684,6 +648,52 @@ incoming_destroy (struct Operation *incoming)
684 648
685 649
686/** 650/**
651 * Clean up after a client has disconnected
652 *
653 * @param cls closure, unused
654 * @param client the client to clean up after
655 * @param internal_cls our client-specific internal data structure
656 */
657static void
658client_disconnect_cb (void *cls,
659 struct GNUNET_SERVICE_Client *client,
660 void *internal_cls)
661{
662 struct Set *set;
663
664 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
665 "client disconnected, cleaning up\n");
666 set = set_get (client);
667 if (NULL != set)
668 {
669 set->client = NULL;
670 set_destroy (set);
671 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
672 "Client's set destroyed\n");
673 }
674 struct Listener *listener = listener_get (client);
675 struct Operation *op = incoming_head;
676 if (NULL != listener)
677 {
678 /* destroy all incoming operations whose client just
679 * got destroyed */
680 while (NULL != op)
681 {
682 struct Operation *curr = op;
683 op = op->next;
684 if ( (GNUNET_YES == curr->is_incoming) &&
685 (curr->listener == listener) )
686 incoming_destroy (curr);
687 }
688 listener->client = NULL;
689 listener_destroy (listener);
690 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
691 "Client's listener destroyed\n");
692 }
693}
694
695
696/**
687 * Suggest the given request to the listener. The listening client can 697 * Suggest the given request to the listener. The listening client can
688 * then accept or reject the remote request. 698 * then accept or reject the remote request.
689 * 699 *