commit 7f2fbbdb0027a16e8de322e40d346cb70809af8f
parent 800ac5056afa9fb4b5add0e503ecd150e594151d
Author: Matthias Wachs <wachs@net.in.tum.de>
Date: Wed, 27 Nov 2013 12:28:49 +0000
minor corrections to revocation service
revocation testtest now passes
Diffstat:
4 files changed, 99 insertions(+), 9 deletions(-)
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am
@@ -61,6 +61,7 @@ test_revocation_SOURCES = \
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
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
@@ -239,6 +239,7 @@ do_flood (void *cls,
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 @@ publicize_rm (const struct RevokeMessage *rm)
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 @@ transmit_task_cb (void *cls,
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 @@ handle_core_connect (void *cls,
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 @@ handle_core_connect (void *cls,
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 @@ handle_core_disconnect (void *cls,
{
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));
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c
@@ -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 TestPeer
{
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 TestPeer
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 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
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 @@ do_shutdown_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
ok = 1;
}
+
static void *
identity_connect_adapter (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -249,6 +257,61 @@ identity_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
}
}
+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,
@@ -271,10 +334,9 @@ test_connection (void *cls, struct GNUNET_TESTBED_RunHandle *h,
{
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 @@ main (int argc, char *argv[])
return ok;
}
-/* end of test_transport_dv.c */
+/* end of test_revocation.c */
diff --git a/src/revocation/test_revocation.conf b/src/revocation/test_revocation.conf
@@ -5,6 +5,9 @@ SERVICEHOME=/tmp/test-revocation-service
[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 @@ SERVERS = dummy
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