gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31226 - gnunet/src/set
Date: Mon, 9 Dec 2013 17:17:20 +0100

Author: cfuchs
Date: 2013-12-09 17:17:19 +0100 (Mon, 09 Dec 2013)
New Revision: 31226

Modified:
   gnunet/src/set/gnunet-service-set_intersection.c
   gnunet/src/set/set_protocol.h
Log:
- more multipart fun
- Make it so

Modified: gnunet/src/set/gnunet-service-set_intersection.c
===================================================================
--- gnunet/src/set/gnunet-service-set_intersection.c    2013-12-09 15:48:51 UTC 
(rev 31225)
+++ gnunet/src/set/gnunet-service-set_intersection.c    2013-12-09 16:17:19 UTC 
(rev 31226)
@@ -341,7 +341,41 @@
   }
 }
 
+static void
+send_bloomfilter_multipart (struct Operation *op, uint32_t offset)
+{
+  struct GNUNET_MQ_Envelope *ev;
+  struct BFMessage *msg;
+  uint32_t chunk_size = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct 
BFMessage));
+  uint32_t todo_size = op->state->local_bf_data_size - offset;
+  
+  if (todo_size < chunk_size)
+    // we probably need many chunks, thus we assume a maximum packet size by 
default
+    chunk_size = todo_size;
+  
+  ev = GNUNET_MQ_msg_extra (msg, chunk_size, 
GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF);
+    
+  msg->reserved = 0;
+  msg->sender_element_count = htonl (op->state->my_element_count);
+  msg->bloomfilter_total_length = htonl (op->state->local_bf_data_size);
+  msg->bloomfilter_length = htonl (chunk_size);
+  msg->bloomfilter_offset = htonl (offset);
+  msg->sender_mutator = htonl (op->spec->salt);
 
+  GNUNET_MQ_send (op->mq, ev);
+  
+  if (op->state->local_bf_data_size == offset + chunk_size)
+  {
+    // done
+    GNUNET_CONTAINER_bloomfilter_free (op->state->local_bf);
+    GNUNET_free(op->state->local_bf_data);
+    op->state->local_bf = NULL;
+    return;
+  }
+  
+  send_bloomfilter_multipart (op, offset + chunk_size);
+}
+
 /**
  * Send a bloomfilter to our peer.
  * that the operation is over.
@@ -378,6 +412,7 @@
     GNUNET_MQ_send (op->mq, ev);
   }
   else {
+    //multipart
     op->state->local_bf_data = (char *)GNUNET_malloc(bf_size);
     GNUNET_assert (GNUNET_SYSERR !=
                  GNUNET_CONTAINER_bloomfilter_get_raw_data 
(op->state->local_bf,

Modified: gnunet/src/set/set_protocol.h
===================================================================
--- gnunet/src/set/set_protocol.h       2013-12-09 15:48:51 UTC (rev 31225)
+++ gnunet/src/set/set_protocol.h       2013-12-09 16:17:19 UTC (rev 31226)
@@ -116,8 +116,13 @@
   uint32_t sender_mutator GNUNET_PACKED;
 
   /**
-   * Length of the bloomfilter data block
+   * Length of the bloomfilter data
    */
+  uint32_t bloomfilter_total_length GNUNET_PACKED;
+  
+  /**
+   * Length of the appended bloomfilter data block
+   */
   uint32_t bloomfilter_length GNUNET_PACKED;
   
   /**




reply via email to

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