- const struct GNUNET_SET_Element *const element = &ke->element->element;
- struct GNUNET_MQ_Envelope *mqm;
- struct GNUNET_MessageHeader *mh;
-
- GNUNET_assert (ke->ibf_key.key_val == ibf_key.key_val);
- mqm = GNUNET_MQ_msg_header_extra (mh, element->size, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS);
- if (NULL == mqm)
+ case PHASE_INITIAL:
+ GNUNET_break_op (0);
+ fail_intersection_operation(op);
+ return;
+ case PHASE_COUNT_SENT:
+ /* This is the first BF being sent, build our initial map with
+ filtering in place */
+ op->state->my_element_count = 0;
+ GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements,
+ &filtered_map_initialization,
+ op);
+ break;
+ case PHASE_BF_EXCHANGE:
+ /* Update our set by reduction */
+ GNUNET_CONTAINER_multihashmap_iterate (op->state->my_elements,
+ &iterator_bf_reduce,
+ op);
+ break;
+ case PHASE_MUST_SEND_DONE:
+ GNUNET_break_op (0);
+ fail_intersection_operation(op);
+ return;
+ case PHASE_DONE_RECEIVED:
+ GNUNET_break_op (0);
+ fail_intersection_operation(op);
+ return;
+ case PHASE_FINISHED:
+ GNUNET_break_op (0);
+ fail_intersection_operation(op);
+ return;
+ }
+ GNUNET_CONTAINER_bloomfilter_free (op->state->remote_bf);
+ op->state->remote_bf = NULL;
+
+ if ( (0 == op->state->my_element_count) || /* fully disjoint */
+ ( (op->state->my_element_count == op->remote_element_count) &&
+ (0 == memcmp (&op->state->my_xor,
+ &op->state->other_xor,
+ sizeof (struct GNUNET_HashCode))) ) )
+ {
+ /* we are done */
+ op->state->phase = PHASE_MUST_SEND_DONE;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Intersection succeeded, sending DONE to other peer\n");
+ GNUNET_CONTAINER_bloomfilter_free (op->state->local_bf);
+ op->state->local_bf = NULL;
+ if (GNUNET_SET_RESULT_FULL == op->result_mode)