gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28610 - gnunet/src/set
Date: Wed, 14 Aug 2013 02:37:29 +0200

Author: dold
Date: 2013-08-14 02:37:28 +0200 (Wed, 14 Aug 2013)
New Revision: 28610

Modified:
   gnunet/src/set/gnunet-service-set.c
   gnunet/src/set/gnunet-service-set_union.c
   gnunet/src/set/gnunet-set-profiler.c
Log:
- fixed generation issues


Modified: gnunet/src/set/gnunet-service-set.c
===================================================================
--- gnunet/src/set/gnunet-service-set.c 2013-08-13 23:39:08 UTC (rev 28609)
+++ gnunet/src/set/gnunet-service-set.c 2013-08-14 00:37:28 UTC (rev 28610)
@@ -1126,7 +1126,6 @@
     {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_IBF, 0},
     {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, 0},
     {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_DONE, 0},
-    {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_DIE, 0},
     {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS, 0},
     {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_SE, 0},
     {NULL, 0, 0}

Modified: gnunet/src/set/gnunet-service-set_union.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union.c   2013-08-13 23:39:08 UTC (rev 
28609)
+++ gnunet/src/set/gnunet-service-set_union.c   2013-08-14 00:37:28 UTC (rev 
28610)
@@ -63,7 +63,7 @@
  * Number of buckets used in the ibf per estimated
  * difference.
  */
-#define IBF_ALPHA 3
+#define IBF_ALPHA 4
 
 
 /**
@@ -521,6 +521,8 @@
   struct InvertibleBloomFilter *ibf = cls;
   struct KeyEntry *ke = value;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "inserting %x into ibf\n", 
ke->ibf_key.key_val);
+
   ibf_insert (ibf, ke->ibf_key);
   return GNUNET_YES;
 }
@@ -534,6 +536,8 @@
  * @param key unised
  * @param value the element entry to insert
  *        into the key-to-element mapping
+ * @return GNUNET_YES to continue iterating,
+ *         GNUNET_NO to stop
  */
 static int
 init_key_to_element_iterator (void *cls,
@@ -550,7 +554,7 @@
          (e->generation_removed < eo->generation_created)))
     return GNUNET_YES;
 
-  e->remote = GNUNET_NO;
+  GNUNET_assert (GNUNET_NO == e->remote);
 
   op_register_element (eo, e);
   return GNUNET_YES;
@@ -663,7 +667,7 @@
   unsigned int ibf_order;
 
   ibf_order = 2;
-  while ((1<<ibf_order) < (IBF_ALPHA * diff))
+  while ((1<<ibf_order) < (IBF_ALPHA * diff) || (1<<ibf_order) < 
SE_IBF_HASH_NUM)
     ibf_order++;
   if (ibf_order > MAX_IBF_ORDER)
     ibf_order = MAX_IBF_ORDER;
@@ -694,12 +698,12 @@
                                        SE_IBF_HASH_NUM);
   strata_estimator_read (&mh[1], remote_se);
   GNUNET_assert (NULL != eo->se);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got se, calculating diff\n");
   diff = strata_estimator_difference (remote_se, eo->se);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "se diff=%d\n", diff);
   strata_estimator_destroy (remote_se);
   strata_estimator_destroy (eo->se);
   eo->se = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got se diff=%d, using ibf size %d\n",
+              diff, 1<<get_order_from_difference (diff));
   send_ibf (eo, get_order_from_difference (diff));
 }
 
@@ -1077,22 +1081,6 @@
 
 
 /**
- * Handle a 'DIE' message from the remote peer.
- * This indicates that the other peer is terminated.
- * 
- * @param cls the union operation
- * @param mh the message
- */
-static void
-handle_p2p_die (void *cls, const struct GNUNET_MessageHeader *mh)
-{
-  struct OperationState *eo = cls;
-
-  send_client_done_and_destroy (eo);
-}
-
-
-/**
  * Handle a done message from a remote peer
  * 
  * @param cls the union operation
@@ -1116,10 +1104,7 @@
   }
   if (eo->phase == PHASE_EXPECT_ELEMENTS)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got final DONE, trying to send 
DIE\n");
-    /* send the die message, which might not even be delivered,
-     * as we could have shut down before that */
-    ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_P2P_DIE);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got final DONE\n");
     eo->phase = PHASE_FINISHED;
     send_client_done_and_destroy (eo);
     return;
@@ -1150,6 +1135,7 @@
   tc->vt = _GSS_union_vt ();
   tc->op = eo;
   eo->se = strata_estimator_dup (spec->set->state->se);
+  eo->generation_created = spec->set->current_generation++;
   eo->set = spec->set;
   eo->spec = spec;
   eo->tunnel = tunnel;
@@ -1304,9 +1290,6 @@
     case GNUNET_MESSAGE_TYPE_SET_P2P_DONE:
       handle_p2p_done (eo, mh);
       break;
-    case GNUNET_MESSAGE_TYPE_SET_P2P_DIE:
-      handle_p2p_die (eo, mh);
-      break;
     default:
       /* something wrong with mesh's message handlers? */
       GNUNET_assert (0);
@@ -1342,7 +1325,6 @@
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "other peer disconnected (finished)\n");
-  /* maybe the other peer did not get to send his 'DIE' message before he 
died? */
   if (GNUNET_NO == op->client_done_sent)
     send_client_done_and_destroy (op);
 }

Modified: gnunet/src/set/gnunet-set-profiler.c
===================================================================
--- gnunet/src/set/gnunet-set-profiler.c        2013-08-13 23:39:08 UTC (rev 
28609)
+++ gnunet/src/set/gnunet-set-profiler.c        2013-08-14 00:37:28 UTC (rev 
28610)
@@ -228,12 +228,12 @@
   info1.id = "a";
   info2.id = "b";
   
-  info1.sent = GNUNET_CONTAINER_multihashmap_create (num_a, GNUNET_NO);
-  info2.sent = GNUNET_CONTAINER_multihashmap_create (num_b, GNUNET_NO);
-  common_sent = GNUNET_CONTAINER_multihashmap_create (num_c, GNUNET_NO);
+  info1.sent = GNUNET_CONTAINER_multihashmap_create (num_a+1, GNUNET_NO);
+  info2.sent = GNUNET_CONTAINER_multihashmap_create (num_b+1, GNUNET_NO);
+  common_sent = GNUNET_CONTAINER_multihashmap_create (num_c+1, GNUNET_NO);
 
-  info1.received = GNUNET_CONTAINER_multihashmap_create (num_a, GNUNET_NO);
-  info2.received = GNUNET_CONTAINER_multihashmap_create (num_b, GNUNET_NO);
+  info1.received = GNUNET_CONTAINER_multihashmap_create (num_a+1, GNUNET_NO);
+  info2.received = GNUNET_CONTAINER_multihashmap_create (num_b+1, GNUNET_NO);
 
   for (i = 0; i < num_a; i++)
   {




reply via email to

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