gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31225 - gnunet/src/set


From: gnunet
Subject: [GNUnet-SVN] r31225 - gnunet/src/set
Date: Mon, 9 Dec 2013 16:48:51 +0100

Author: cfuchs
Date: 2013-12-09 16:48:51 +0100 (Mon, 09 Dec 2013)
New Revision: 31225

Modified:
   gnunet/src/set/gnunet-service-set_intersection.c
   gnunet/src/set/set_protocol.h
Log:
towards multipart msging for bloomfilters in set intersection

Modified: gnunet/src/set/gnunet-service-set_intersection.c
===================================================================
--- gnunet/src/set/gnunet-service-set_intersection.c    2013-12-09 15:37:01 UTC 
(rev 31224)
+++ gnunet/src/set/gnunet-service-set_intersection.c    2013-12-09 15:48:51 UTC 
(rev 31225)
@@ -76,6 +76,16 @@
    * BF of the set's element.
    */
   struct GNUNET_CONTAINER_BloomFilter *local_bf;
+  
+  /**
+   * for multipart msgs we have to store the bloomfilter-data until we fully 
sent it.
+   */
+  char * local_bf_data;
+  
+  /**
+   * for multipart msgs we have to store the bloomfilter-data until we fully 
sent it.
+   */
+  uint32_t local_bf_data_size;
 
   /**
    * Current state of the operation.
@@ -351,19 +361,31 @@
 
   // send our bloomfilter
   bf_size = GNUNET_CONTAINER_bloomfilter_get_size (op->state->local_bf);
+  if ( GNUNET_SERVER_MAX_MESSAGE_SIZE <= bf_size + sizeof(struct BFMessage))
+  {
+    // singlepart
+    ev = GNUNET_MQ_msg_extra (msg, bf_size, 
GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF);
+    
+    GNUNET_CONTAINER_bloomfilter_free (op->state->local_bf);
+    op->state->local_bf = NULL;
+    
+    msg->reserved = 0;
+    msg->sender_element_count = htonl (op->state->my_element_count);
+    msg->bloomfilter_length = htonl (bf_size);
+    msg->bloomfilter_offset = htonl (0);
+    msg->sender_mutator = htonl (op->spec->salt);
 
-  ev = GNUNET_MQ_msg_extra (msg, bf_size, 
GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF);
-  msg->reserved = 0;
-  msg->sender_element_count = htonl (op->state->my_element_count);
-  msg->bloomfilter_length = htonl (bf_size);
-  msg->sender_mutator = htonl (op->spec->salt);
-  GNUNET_assert (GNUNET_SYSERR !=
+    GNUNET_MQ_send (op->mq, ev);
+  }
+  else {
+    op->state->local_bf_data = (char *)GNUNET_malloc(bf_size);
+    GNUNET_assert (GNUNET_SYSERR !=
                  GNUNET_CONTAINER_bloomfilter_get_raw_data 
(op->state->local_bf,
-                                                            (char *) &msg[1],
+                                                            
op->state->local_bf_data,
                                                             bf_size));
-  GNUNET_CONTAINER_bloomfilter_free (op->state->local_bf);
-  op->state->local_bf = NULL;
-  GNUNET_MQ_send (op->mq, ev);
+    op->state->local_bf_data_size = bf_size;
+    send_bloomfilter_multipart (op, 0);
+  }
 }
 
 

Modified: gnunet/src/set/set_protocol.h
===================================================================
--- gnunet/src/set/set_protocol.h       2013-12-09 15:37:01 UTC (rev 31224)
+++ gnunet/src/set/set_protocol.h       2013-12-09 15:48:51 UTC (rev 31225)
@@ -121,6 +121,11 @@
   uint32_t bloomfilter_length GNUNET_PACKED;
   
   /**
+   * offset in the bloolfilter data block, if multipart message
+   */
+  uint32_t bloomfilter_offset GNUNET_PACKED;
+  
+  /**
    * rest: the sender's bloomfilter
    */
 };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]