-do not run tests if disabled
[oweals/gnunet.git] / src / set / gnunet-service-set_intersection.c
index 27110077e0b38e20a15f78b56cb688f9410452a1..60677615427cf2f6597c785696f94c41ef7fe1e7 100644 (file)
@@ -17,7 +17,6 @@
       Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       Boston, MA 02111-1307, USA.
 */
-
 /**
  * @file set/gnunet-service-set_intersection.c
  * @brief two-peer set intersection
@@ -86,30 +85,24 @@ struct OperationState
   struct GNUNET_CONTAINER_BloomFilter *local_bf;
 
   /**
-   * for multipart msgs we have to store the bloomfilter-data until we fully sent it.
-   */
-  char * bf_data;
-
-  /**
-   * size of the bloomfilter
+   * Iterator for sending elements on the key to element mapping to the client.
    */
-  uint32_t bf_data_size;
+  struct GNUNET_CONTAINER_MultiHashMapIterator *full_result_iter;
 
   /**
-   * size of the bloomfilter
+   * Evaluate operations are held in a linked list.
    */
-  uint32_t bf_bits_per_element;
+  struct OperationState *next;
 
   /**
-   * Current state of the operation.
+   * Evaluate operations are held in a linked list.
    */
-  enum IntersectionOperationPhase phase;
+  struct OperationState *prev;
 
   /**
-   * Generation in which the operation handle
-   * was created.
+   * for multipart msgs we have to store the bloomfilter-data until we fully sent it.
    */
-  unsigned int generation_created;
+  char *bf_data;
 
   /**
    * Maps element-id-hashes to 'elements in our set'.
@@ -117,26 +110,30 @@ struct OperationState
   struct GNUNET_CONTAINER_MultiHashMap *my_elements;
 
   /**
-   * Current element count contained within contained_elements
+   * Current element count contained within @e my_elements
    */
   uint32_t my_element_count;
 
   /**
-   * Iterator for sending elements on the key to element mapping to the client.
+   * size of the bloomfilter in @e bf_data.
    */
-  struct GNUNET_CONTAINER_MultiHashMapIterator *full_result_iter;
+  uint32_t bf_data_size;
 
   /**
-   * Evaluate operations are held in
-   * a linked list.
+   * size of the bloomfilter
    */
-  struct OperationState *next;
+  uint32_t bf_bits_per_element;
 
-   /**
-    * Evaluate operations are held in
-    * a linked list.
-    */
-  struct OperationState *prev;
+  /**
+   * Current state of the operation.
+   */
+  enum IntersectionOperationPhase phase;
+
+  /**
+   * Generation in which the operation handle
+   * was created.
+   */
+  unsigned int generation_created;
 
   /**
    * Did we send the client that we are done?
@@ -237,6 +234,7 @@ iterator_initialization_by_alice (void *cls,
   return GNUNET_YES;
 }
 
+
 /**
  * fills the contained-elements hashmap with all relevant
  * elements and adds their mutated hashes to our local bloomfilter
@@ -361,7 +359,7 @@ fail_intersection_operation (struct Operation *op)
   msg->request_id = htonl (op->spec->client_request_id);
   msg->element_type = htons (0);
   GNUNET_MQ_send (op->spec->set->client_mq, ev);
-  _GSS_operation_destroy (op);
+  _GSS_operation_destroy (op, GNUNET_YES);
 }
 
 
@@ -527,12 +525,13 @@ send_client_done_and_destroy (void *cls)
   struct Operation *op = cls;
   struct GNUNET_MQ_Envelope *ev;
   struct GNUNET_SET_ResultMessage *rm;
+
   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);
+  _GSS_operation_destroy (op, GNUNET_YES);
 }
 
 
@@ -1052,7 +1051,7 @@ intersection_peer_disconnect (struct Operation *op)
     GNUNET_MQ_send (op->spec->set->client_mq, ev);
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "other peer disconnected prematurely\n");
-    _GSS_operation_destroy (op);
+    _GSS_operation_destroy (op, GNUNET_YES);
     return;
   }
   // else: the session has already been concluded
@@ -1093,9 +1092,16 @@ intersection_op_cancel (struct Operation *op)
   }*/
   GNUNET_free (op->state);
   op->state = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "destroying intersection op done\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "destroying intersection op done\n");
 }
 
+
+/**
+ * Get the table with implementing functions for set intersection.
+ *
+ * @return the operation specific VTable
+ */
 const struct SetVT *
 _GSS_intersection_vt ()
 {