gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30905 - gnunet/src/revocation


From: gnunet
Subject: [GNUnet-SVN] r30905 - gnunet/src/revocation
Date: Wed, 27 Nov 2013 13:28:49 +0100

Author: wachs
Date: 2013-11-27 13:28:49 +0100 (Wed, 27 Nov 2013)
New Revision: 30905

Modified:
   gnunet/src/revocation/Makefile.am
   gnunet/src/revocation/gnunet-service-revocation.c
   gnunet/src/revocation/test_revocation.c
   gnunet/src/revocation/test_revocation.conf
Log:
minor corrections to revocation service
revocation testtest now passes


Modified: gnunet/src/revocation/Makefile.am
===================================================================
--- gnunet/src/revocation/Makefile.am   2013-11-27 11:45:45 UTC (rev 30904)
+++ gnunet/src/revocation/Makefile.am   2013-11-27 12:28:49 UTC (rev 30905)
@@ -61,6 +61,7 @@
 test_revocation_LDADD = \
  $(top_builddir)/src/identity/libgnunetidentity.la \
  $(top_builddir)/src/revocation/libgnunetrevocation.la \
+ $(top_builddir)/src//core/libgnunetcore.la \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/testbed/libgnunettestbed.la
 

Modified: gnunet/src/revocation/gnunet-service-revocation.c
===================================================================
--- gnunet/src/revocation/gnunet-service-revocation.c   2013-11-27 11:45:45 UTC 
(rev 30904)
+++ gnunet/src/revocation/gnunet-service-revocation.c   2013-11-27 12:28:49 UTC 
(rev 30905)
@@ -239,6 +239,7 @@
 
   e = GNUNET_MQ_msg (cp, GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
   *cp = *rm;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Flooding revocation to `%s'\n", 
GNUNET_i2s (target));
   GNUNET_MQ_send (pe->mq, e);
   return GNUNET_OK;
 }
@@ -313,6 +314,11 @@
     GNUNET_break (0);
     return GNUNET_OK;
   }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Added revocation info to SET\n");
+  }
   /* flood to neighbours */
   GNUNET_CONTAINER_multipeermap_iterate (peers,
                                         &do_flood,
@@ -459,6 +465,10 @@
   struct PeerEntry *peer_entry = cls;
   uint16_t salt;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Starting set exchange with peer `%s'\n",
+              GNUNET_i2s (&peer_entry->id));
+
   salt = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
                                               UINT16_MAX);
   peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
@@ -495,6 +505,9 @@
   struct GNUNET_HashCode my_hash;
   struct GNUNET_HashCode peer_hash;
 
+  if (0 == memcmp(peer, &my_identity, sizeof (my_identity)))
+      return;
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Peer `%s' connected to us\n",
               GNUNET_i2s (peer));
@@ -519,6 +532,9 @@
   if (0 < GNUNET_CRYPTO_hash_cmp (&my_hash,
                                   &peer_hash))
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Starting SET operation with peer `%s'\n",
+                GNUNET_i2s (peer));
     peer_entry->transmit_task =
       GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
                                     &transmit_task_cb,
@@ -541,6 +557,9 @@
 {
   struct PeerEntry *pos;
 
+  if (0 == memcmp(peer, &my_identity, sizeof (my_identity)))
+      return;
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Peer `%s' disconnected from us\n",
               GNUNET_i2s (peer));

Modified: gnunet/src/revocation/test_revocation.c
===================================================================
--- gnunet/src/revocation/test_revocation.c     2013-11-27 11:45:45 UTC (rev 
30904)
+++ gnunet/src/revocation/test_revocation.c     2013-11-27 12:28:49 UTC (rev 
30905)
@@ -18,8 +18,8 @@
  Boston, MA 02111-1307, USA.
  */
 /**
- * @file dv/test_transport_dv.c
- * @brief base testcase for testing distance vector transport
+ * @file revocation/test_revocation.c
+ * @brief base testcase for revocation exchange
  */
 #include "platform.h"
 #include "gnunet_core_service.h"
@@ -33,6 +33,7 @@
 {
   struct GNUNET_TESTBED_Peer *p;
   struct GNUNET_TESTBED_Operation *identity_op;
+  struct GNUNET_TESTBED_Operation *core_op;
   struct GNUNET_IDENTITY_Handle *idh;
   const struct GNUNET_CONFIGURATION_Handle *cfg;
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
@@ -41,6 +42,7 @@
   struct GNUNET_IDENTITY_Operation *create_id_op;
   struct GNUNET_IDENTITY_EgoLookup *ego_lookup;
   struct GNUNET_REVOCATION_Handle *revok_handle;
+  struct GNUNET_CORE_Handle *ch;
   uint64_t pow;
 };
 
@@ -87,6 +89,11 @@
       GNUNET_TESTBED_operation_done (testpeers[c].identity_op);
       testpeers[c].identity_op = NULL;
     }
+    if (NULL != testpeers[c].core_op)
+    {
+      GNUNET_TESTBED_operation_done (testpeers[c].core_op);
+      testpeers[c].core_op = NULL;
+    }
   }
   GNUNET_SCHEDULER_shutdown ();
   ok = 0;
@@ -101,6 +108,7 @@
   ok = 1;
 }
 
+
 static void *
 identity_connect_adapter (void *cls,
     const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -249,7 +257,62 @@
   }
 }
 
+void static connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer)
+{
+  static int connects = 0;
+  connects++;
+  if (4 == connects)
+  {
+    GNUNET_log(GNUNET_ERROR_TYPE_INFO, "All peers connected ...\n");
+
+    /* Connect to identity service */
+    testpeers[0].identity_op = GNUNET_TESTBED_service_connect (NULL,
+        testpeers[0].p, "identity", identity_completion_cb, NULL,
+        &identity_connect_adapter, &identity_disconnect_adapter,
+        &testpeers[0]);
+    testpeers[1].identity_op = GNUNET_TESTBED_service_connect (NULL,
+        testpeers[1].p, "identity", identity_completion_cb, NULL,
+        &identity_connect_adapter, &identity_disconnect_adapter,
+        &testpeers[1]);
+  }
+}
+
+
 static void
+core_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
+    void *ca_result, const char *emsg)
+{
+  static int completed = 0;
+  completed++;
+  if (NUM_TEST_PEERS == completed)
+  {
+    GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connected to CORE\n");
+  }
+}
+
+
+static void *
+core_connect_adapter (void *cls,
+    const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  struct TestPeer *me = cls;
+  me->cfg = cfg;
+  me->ch = GNUNET_CORE_connect (cfg, me, NULL, &connect_cb, NULL, NULL, 
GNUNET_NO, NULL, GNUNET_NO, NULL);
+  if (NULL == me->ch)
+    GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create CORE handle \n");
+  return me->ch;
+}
+
+
+static void
+core_disconnect_adapter (void *cls, void *op_result)
+{
+  struct TestPeer *me = cls;
+  GNUNET_CORE_disconnect (me->ch);
+  me->ch = NULL;
+}
+
+static void
 test_connection (void *cls, struct GNUNET_TESTBED_RunHandle *h,
     unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers,
     unsigned int links_succeeded, unsigned int links_failed)
@@ -271,10 +334,9 @@
     {
       testpeers[c].p = peers[c];
 
-      /* Connect to identity service */
-      testpeers[c].identity_op = GNUNET_TESTBED_service_connect (NULL,
-          testpeers[c].p, "identity", identity_completion_cb, NULL,
-          &identity_connect_adapter, &identity_disconnect_adapter,
+      testpeers[c].core_op = GNUNET_TESTBED_service_connect (NULL,
+          testpeers[c].p, "core", &core_completion_cb, NULL,
+          &core_connect_adapter, &core_disconnect_adapter,
           &testpeers[c]);
     }
   }
@@ -290,4 +352,4 @@
   return ok;
 }
 
-/* end of test_transport_dv.c */
+/* end of test_revocation.c */

Modified: gnunet/src/revocation/test_revocation.conf
===================================================================
--- gnunet/src/revocation/test_revocation.conf  2013-11-27 11:45:45 UTC (rev 
30904)
+++ gnunet/src/revocation/test_revocation.conf  2013-11-27 12:28:49 UTC (rev 
30905)
@@ -5,6 +5,9 @@
 [revocation]
 WORKBITS = 5
 
+[arm]
+DEFAULTSERVICES = core identity revocation
+
 [identity]
 # Directory where we store information about our egos
 EGODIR = $GNUNET_HOME/identity/egos/
@@ -18,4 +21,10 @@
 BROADCAST = NO
 
 [peerinfo]
-USE_INCLUDED_HELLOS = NO
\ No newline at end of file
+USE_INCLUDED_HELLOS = NO
+
+[testbed]
+OVERLAY_TOPOLOGY = CLIQUE
+SETUP_TIMEOUT = 1 m
+OPERATION_TIMEOUT = 5 s
+CACHE_SIZE = 0




reply via email to

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