- * Send a request for the evaluate operation to a remote peer
- *
- * @param op operation with the other peer
- */
-static void
-send_operation_request (struct Operation *op)
-{
- struct GNUNET_MQ_Envelope *ev;
- struct OperationRequestMessage *msg;
-
- ev = GNUNET_MQ_msg_nested_mh (msg, GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST,
- op->spec->context_msg);
-
- if (NULL == ev)
- {
- /* the context message is too large */
- GNUNET_break (0);
- GNUNET_SERVER_client_disconnect (op->spec->set->client);
- return;
- }
- msg->operation = htonl (GNUNET_SET_OPERATION_INTERSECTION);
- msg->app_id = op->spec->app_id;
- msg->salt = htonl (op->spec->salt);
- msg->element_count = htonl(op->state->my_element_count);
-
- GNUNET_MQ_send (op->mq, ev);
-
- if (NULL != op->spec->context_msg)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sent op request with context message\n");
- else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sent op request without context message\n");
-
- if (NULL != op->spec->context_msg)
- {
- GNUNET_free (op->spec->context_msg);
- op->spec->context_msg = NULL;
- }
-}
-
-static void
-send_bloomfilter_multipart (struct Operation *op, uint32_t offset)
-{
- struct GNUNET_MQ_Envelope *ev;
- struct BFPart *msg;
- uint32_t chunk_size = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct BFPart));
- uint32_t todo_size = op->state->bf_data_size - offset;
-
- if (todo_size < chunk_size)
- chunk_size = todo_size;
-
- ev = GNUNET_MQ_msg_extra (msg, chunk_size, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF_PART);
-
- msg->chunk_length = htonl (chunk_size);
- msg->chunk_offset = htonl (offset);
- memcpy(&msg[1], &op->state->bf_data[offset], chunk_size);
-
- GNUNET_MQ_send (op->mq, ev);
-
- if (op->state->bf_data_size == offset + chunk_size)
- {
- // done
- GNUNET_free(op->state->bf_data);
- op->state->bf_data = NULL;
- return;
- }
-
- send_bloomfilter_multipart (op, offset + chunk_size);
-}
-
-/**
- * Send a bloomfilter to our peer.
- * that the operation is over.
- * After the result done message has been sent to the client,
- * destroy the evaluate operation.