+ GNUNET_MQ_send (op->spec->set->client_mq, ev);
+}
+
+
+/**
+ * Signal to the client that the operation has finished and
+ * destroy the operation.
+ *
+ * @param cls operation to destroy
+ */
+static void
+send_done_and_destroy (void *cls)
+{
+ struct Operation *op = cls;
+ struct GNUNET_MQ_Envelope *ev;
+ struct GNUNET_SET_ResultMessage *rm;
+ int keep = op->keep;
+
+ ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT);
+ rm->request_id = htonl (op->spec->client_request_id);
+ rm->result_status = htons (GNUNET_SET_STATUS_DONE);
+ rm->element_type = htons (0);
+ GNUNET_MQ_send (op->spec->set->client_mq, ev);
+ _GSS_operation_destroy (op, GNUNET_YES);
+ if (GNUNET_YES == keep)
+ GNUNET_free (op);
+}
+
+
+/**
+ * Send all remaining elements in the full result iterator.
+ *
+ * @param cls operation
+ */
+static void
+send_remaining_elements (void *cls)
+{
+ struct Operation *op = cls;
+ struct KeyEntry *ke;
+ int res;
+
+ res = GNUNET_CONTAINER_multihashmap32_iterator_next (op->state->full_result_iter, NULL, (const void **) &ke);
+ if (GNUNET_NO == res)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending done and destroy because iterator ran out\n");
+ send_done_and_destroy (op);
+ return;
+ }
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending elements from key entry\n");
+
+ while (1)
+ {
+ struct GNUNET_MQ_Envelope *ev;
+ struct GNUNET_SET_ResultMessage *rm;
+ struct GNUNET_SET_Element *element;
+ element = &ke->element->element;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending element (size %u) to client (full set)\n", element->size);
+ GNUNET_assert (0 != op->spec->client_request_id);
+ ev = GNUNET_MQ_msg_extra (rm, element->size, GNUNET_MESSAGE_TYPE_SET_RESULT);
+ if (NULL == ev)
+ {
+ GNUNET_MQ_discard (ev);
+ GNUNET_break (0);
+ continue;
+ }
+ rm->result_status = htons (GNUNET_SET_STATUS_OK);
+ rm->request_id = htonl (op->spec->client_request_id);
+ rm->element_type = element->element_type;
+ memcpy (&rm[1], element->data, element->size);
+ if (ke->next_colliding == NULL)
+ {
+ GNUNET_MQ_notify_sent (ev, send_remaining_elements, op);
+ GNUNET_MQ_send (op->spec->set->client_mq, ev);
+ break;
+ }
+ GNUNET_MQ_send (op->spec->set->client_mq, ev);
+ ke = ke->next_colliding;
+ }