GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE,
struct GNUNET_MessageHeader,
NULL),
+ GNUNET_MQ_hd_fixed_size (union_p2p_over,
+ GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER,
+ struct GNUNET_MessageHeader,
+ NULL),
GNUNET_MQ_hd_fixed_size (union_p2p_full_done,
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE,
struct GNUNET_MessageHeader,
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE,
struct GNUNET_MessageHeader,
op),
+ GNUNET_MQ_hd_fixed_size (union_p2p_over,
+ GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER,
+ struct GNUNET_MessageHeader,
+ op),
GNUNET_MQ_hd_fixed_size (union_p2p_full_done,
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE,
struct GNUNET_MessageHeader,
* @param cls operation to destroy
*/
static void
-send_done_and_destroy (void *cls)
+send_client_done (void *cls)
{
struct Operation *op = cls;
struct GNUNET_MQ_Envelope *ev;
rm->current_size = GNUNET_htonll (GNUNET_CONTAINER_multihashmap32_size (op->state->key_to_element));
GNUNET_MQ_send (op->set->cs->mq,
ev);
+}
+
+/**
+ * Signal to the client that the operation has finished and
+ * destroy the operation.
+ *
+ * @param cls operation to destroy
+ */
+static void
+send_client_done_and_destroy (void *cls)
+{
+ struct Operation *op = cls;
+ send_client_done (cls);
/* Will also call the union-specific cancel function. */
_GSS_operation_destroy (op,
GNUNET_YES);
ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE);
GNUNET_MQ_send (op->mq,
ev);
- /* We now wait until the other peer closes the channel
+ /* We now wait until the other peer sends P2P_OVER
* after it got all elements from us. */
}
}
num_demanded);
if (0 == num_demanded)
{
+ struct GNUNET_MQ_Envelope *ev;
+
op->state->phase = PHASE_DONE;
- send_done_and_destroy (op);
+ ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER);
+ GNUNET_MQ_notify_sent (ev,
+ &send_client_done,
+ op);
+ GNUNET_MQ_send (op->mq,
+ ev);
}
}
}
ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE);
GNUNET_MQ_notify_sent (ev,
- &send_done_and_destroy,
+ &send_client_done,
op);
GNUNET_MQ_send (op->mq,
ev);
/* We sent the full set, and got the response for that. We're done. */
op->state->phase = PHASE_DONE;
GNUNET_CADET_receive_done (op->channel);
- send_done_and_destroy (op);
+ send_client_done_and_destroy (op);
return;
}
break;
}
}
+/**
+ * Handle a over message from a remote peer
+ *
+ * @param cls the union operation
+ * @param mh the message
+ */
+void
+handle_union_p2p_over (void *cls,
+ const struct GNUNET_MessageHeader *mh)
+{
+ send_client_done (cls);
+}
+
/**
* Initiate operation to evaluate a set union with a remote peer.