[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8294 - GNUnet/src/applications/dv/module
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8294 - GNUnet/src/applications/dv/module |
Date: |
Fri, 27 Feb 2009 15:52:14 -0700 |
Author: nevans
Date: 2009-02-27 15:52:14 -0700 (Fri, 27 Feb 2009)
New Revision: 8294
Added:
GNUnet/src/applications/dv/module/check.conf
GNUnet/src/applications/dv/module/dv_tbench.c
GNUnet/src/applications/dv/module/dv_tbench.h
GNUnet/src/applications/dv/module/dv_test.conf
GNUnet/src/applications/dv/module/dvtest.c
GNUnet/src/applications/dv/module/gnunetd_dv.conf
Modified:
GNUnet/src/applications/dv/module/Makefile.am
GNUnet/src/applications/dv/module/dv.c
GNUnet/src/applications/dv/module/dv_heaptest.c
Log:
dv tests
Modified: GNUnet/src/applications/dv/module/Makefile.am
===================================================================
--- GNUnet/src/applications/dv/module/Makefile.am 2009-02-27 01:02:26 UTC
(rev 8293)
+++ GNUnet/src/applications/dv/module/Makefile.am 2009-02-27 22:52:14 UTC
(rev 8294)
@@ -15,22 +15,44 @@
dv.c heap.c
plugin_LTLIBRARIES = \
- libgnunetmodule_dv.la
+ libgnunetmodule_dv.la \
+ libgnunetmodule_dv_tbench.la
libgnunetmodule_dv_la_SOURCES = \
- dv.c heap.c
+ dv.c heap.c \
+ service.c
libgnunetmodule_dv_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
libgnunetmodule_dv_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
+
+libgnunetmodule_dv_tbench_la_SOURCES = \
+ dv_tbench.c \
+ dv_tbench.h
+libgnunetmodule_dv_tbench_la_LDFLAGS = \
+ $(GN_PLUGIN_LDFLAGS)
+libgnunetmodule_dv_tbench_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(GN_LIBINTL)
+
check_PROGRAMS = \
heaptest \
- dv_heaptest
+ dv_heaptest \
+ dvtest
TESTS = $(check_PROGRAMS)
+dvtest_SOURCES = \
+ dvtest.c
+dvtest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/applications/dv/module/libheap.la \
+ $(top_builddir)/src/applications/stats/libgnunetstatsapi.la \
+ $(top_builddir)/src/applications/testing/libgnunetremoteapi.la \
+ $(top_builddir)/src/applications/testing/libgnunettestingapi.la
+
heaptest_SOURCES = \
heaptest.c
heaptest_LDADD = \
@@ -43,3 +65,8 @@
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/applications/dv/module/libheap.la
+EXTRA_DIST = \
+ check.conf \
+ dv_test.conf \
+ gnunetd_dv.conf
+
Added: GNUnet/src/applications/dv/module/check.conf
===================================================================
--- GNUnet/src/applications/dv/module/check.conf
(rev 0)
+++ GNUnet/src/applications/dv/module/check.conf 2009-02-27 22:52:14 UTC
(rev 8294)
@@ -0,0 +1,16 @@
+# General settings
+[GNUNET]
+GNUNET_HOME = "/tmp/gnunet-session-test-driver"
+LOGLEVEL = "ERROR"
+LOGFILE = ""
+PROCESS-PRIORITY = "NORMAL"
+
+# Network options for the clients
+[NETWORK]
+HOST = "localhost:2087"
+
+
+[TESTING]
+WEAKRANDOM = YES
+
+
Modified: GNUnet/src/applications/dv/module/dv.c
===================================================================
--- GNUnet/src/applications/dv/module/dv.c 2009-02-27 01:02:26 UTC (rev
8293)
+++ GNUnet/src/applications/dv/module/dv.c 2009-02-27 22:52:14 UTC (rev
8294)
@@ -33,7 +33,8 @@
#include "dv.h"
#include "heap.h"
-#define DEBUG_DV
+#define DEBUG_DV GNUNET_NO
+#define DEBUG_DV_FORWARD GNUNET_NO
/* How long to allow a message to be delayed */
#define DV_DELAY (100 * GNUNET_CRON_MILLISECONDS)
@@ -109,7 +110,66 @@
return;
}
+/*
+ * Forward a received message that was not intended
+ * for us.
+ *
+ * @recipient for which peer is this message intended
+ * @message message being forwarded
+ */
+static int
+forward_message (p2p_dv_MESSAGE_Data *message)
+{
+ p2p_dv_MESSAGE_Data *toSend;
+ GNUNET_MessageHeader *packed_message = (GNUNET_MessageHeader *)&message[1];
+ int ret = GNUNET_OK;
+ unsigned int msg_size;
+ struct GNUNET_dv_neighbor *neighbor;
+ if (ntohs(message->header.size) != (sizeof(p2p_dv_MESSAGE_Data) +
ntohs(packed_message->size)))
+ {
+ return GNUNET_SYSERR;
+ }
+ if (GNUNET_YES ==
+ GNUNET_multi_hash_map_contains (ctx->extended_neighbors,
+ &message->recipient.hashPubKey))
+ {
+#if DEBUG_DV_FORWARD
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Sending a forwarded message!\n");
+#endif
+ neighbor =
+ GNUNET_multi_hash_map_get (ctx->extended_neighbors,
+ &message->recipient.hashPubKey);
+ msg_size = ntohs(message->header.size);
+ if (msg_size > GNUNET_MAX_BUFFER_SIZE - 8)
+ return GNUNET_SYSERR;
+ toSend = GNUNET_malloc (msg_size);
+ toSend->header.size = htons (msg_size);
+ toSend->header.type = htons (GNUNET_P2P_PROTO_DV_DATA_MESSAGE);
+ memcpy (&toSend->sender, &message->sender, sizeof(GNUNET_PeerIdentity));
+ memcpy (&toSend->recipient, &message->recipient, sizeof
(GNUNET_PeerIdentity));
+ memcpy (&toSend[1], packed_message, packed_message->size);
+ coreAPI->ciphertext_send (neighbor->neighbor, &toSend->header, 0,
+ DV_DELAY);
+ GNUNET_free (toSend);
+ return ret;
+ }
+ else
+ {
+#if DEBUG_DV_FORWARD
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Attempted to send a message to an unknown peer!\n");
+#endif
+ return GNUNET_NO;
+ }
+
+}
+
/*
* Handle a message receipt, if recipient matches ident message is
* for this peer, otherwise check if we know of the intended
@@ -119,84 +179,138 @@
p2pHandleDVDataMessage (const GNUNET_PeerIdentity * sender,
const GNUNET_MessageHeader * message)
{
+#if DEBUG_DV_FORWARD
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Entering p2pHandleDVDataMessage, Received message!\n");
+#endif
p2p_dv_MESSAGE_Data *incoming;
incoming = (p2p_dv_MESSAGE_Data *) message;
+ GNUNET_MessageHeader *packed_message = (GNUNET_MessageHeader *)&incoming[1];
char *message_content;
unsigned int message_length;
int ret;
-
+#if DEBUG_DV_FORWARD
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Got message original size: %d, packed message size %d
(original should be packed size + %d)\n", ntohs(incoming->header.size),
ntohs(packed_message->size), sizeof (p2p_dv_MESSAGE_Data));
+#endif
ret = GNUNET_OK;
- if (ntohs (incoming->header.size) < sizeof (p2p_dv_MESSAGE_Data))
- {
- return GNUNET_SYSERR;
- }
+ if ((ntohs (incoming->header.size) < sizeof (p2p_dv_MESSAGE_Data)) ||
(ntohs(incoming->header.size) != (sizeof(p2p_dv_MESSAGE_Data) +
ntohs(packed_message->size))))
+ {
+#if DEBUG_DV_FORWARD
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Got bad message size. Expected at least %d, got %d,
packed message size %d\n", sizeof (p2p_dv_MESSAGE_Data),
ntohs(incoming->header.size), ntohs(packed_message->size));
+#endif
+ return GNUNET_SYSERR;
+ }
message_length =
ntohs (incoming->header.size) - sizeof (p2p_dv_MESSAGE_Data);
- message_content = GNUNET_malloc (message_length + 1);
+ message_content = GNUNET_malloc (message_length);
memcpy (message_content, &incoming[1], message_length);
- message_content[message_length] = '\0';
-
+#if DEBUG_DV
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Guessing packed message size %d, actual packed message
size %d\n", message_length, ntohs(packed_message->size));
+#endif
if (memcmp
(coreAPI->my_identity, &incoming->recipient,
sizeof (GNUNET_PeerIdentity)) == 0)
{
/*FIXME: Deliver message up to ??? Handle arbitrary messages? */
-#ifdef DEBUG_DV
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK,
- "Received message %s intended for this node!\n",
- message_content);
+#if DEBUG_DV_FORWARD
+ GNUNET_EncName encMe;
+ GNUNET_EncName encRecipient;
+ GNUNET_hash_to_enc (coreAPI->my_identity, &encMe);
+ GNUNET_hash_to_enc (&incoming->recipient, &encRecipient);
+
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK, "Received message for: %s, I am %s\n", (char
*)&encRecipient, (char*)&encMe);
+
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Received message intended for this node!\n",
+ message_content);
#endif
+ coreAPI->loopback_send(&incoming->sender, (char *)packed_message,
ntohs(packed_message->size), GNUNET_YES, NULL);
}
else
{
-#ifdef DEBUG_DV
+ fprintf(stderr, "\n\n\nOTHER NODES MESSAGE\n\n\n");
+#if DEBUG_DV_FORWARD
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
- "Received message %s for some other node!\n",
+ "Received message for some other node!\n",
message_content);
#endif
- ret = GNUNET_DV_send_message (&incoming->recipient, message_content);
+ ret = forward_message (incoming);
}
GNUNET_free (message_content);
return ret;
}
-
+/*
+ * Build and send a fresh message from this peer to a
+ * peer in the fisheye neighborhood. Returns GNUNET_OK
+ * provided all goes well, GNUNET_NO if recipient is not
+ * in the neighborhood, and GNUNET_SYSERR if some other
+ * problem happens
+ *
+ * @recipient for which peer is this message intended
+ * @message message being sent
+ */
int
-GNUNET_DV_send_message (const GNUNET_PeerIdentity * recipient, char *message)
+GNUNET_DV_send_message (const GNUNET_PeerIdentity * recipient, const
GNUNET_MessageHeader *message)
{
p2p_dv_MESSAGE_Data *toSend;
int ret = GNUNET_OK;
unsigned int msg_size;
struct GNUNET_dv_neighbor *neighbor;
-
+#if DEBUG_DV_FORWARD
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Entered GNUNET_DV_send_message!\n");
+#endif
if (GNUNET_YES ==
GNUNET_multi_hash_map_contains (ctx->extended_neighbors,
&recipient->hashPubKey))
{
+#if DEBUG_DV_FORWARD
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "Found peer, attempting to send message!\n");
+#endif
neighbor =
GNUNET_multi_hash_map_get (ctx->extended_neighbors,
&recipient->hashPubKey);
- msg_size = strlen (message) + sizeof (p2p_dv_MESSAGE_Data);
+ msg_size = ntohs(message->size) + sizeof (p2p_dv_MESSAGE_Data);
if (msg_size > GNUNET_MAX_BUFFER_SIZE - 8)
return GNUNET_SYSERR;
toSend = GNUNET_malloc (msg_size);
toSend->header.size = htons (msg_size);
toSend->header.type = htons (GNUNET_P2P_PROTO_DV_DATA_MESSAGE);
+ memcpy (&toSend->sender, coreAPI->my_identity ,
sizeof(GNUNET_PeerIdentity));
memcpy (&toSend->recipient, recipient, sizeof (GNUNET_PeerIdentity));
- memcpy (&toSend[1], message, strlen (message));
+ memcpy (&toSend[1], message, ntohs(message->size));
coreAPI->ciphertext_send (neighbor->neighbor, &toSend->header, 0,
- DV_DELAY);
+ 0);
GNUNET_free (toSend);
return ret;
}
else
{
-#ifdef DEBUG_DV
+#if DEBUG_DV_FORWARD
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK,
@@ -223,7 +337,7 @@
{
int ret;
struct GNUNET_dv_neighbor *neighbor;
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_EncName encPeer;
GNUNET_EncName encReferrer;
GNUNET_GE_LOG (coreAPI->ectx,
@@ -329,7 +443,7 @@
}
-#ifdef DEBUG_DV
+#if DEBUG_DV
print_tables ();
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
@@ -346,7 +460,7 @@
{
int ret = GNUNET_OK;
const p2p_dv_MESSAGE_NeighborInfo *nmsg;
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_EncName from;
GNUNET_EncName about;
#endif
@@ -365,7 +479,7 @@
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Problem adding/updating neighbor in `%s'\n"), "dv");
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_hash_to_enc (&sender->hashPubKey, &from);
GNUNET_hash_to_enc (&nmsg->neighbor.hashPubKey, &about);
GNUNET_GE_LOG (coreAPI->ectx,
@@ -385,7 +499,7 @@
static void
peer_connect_handler (const GNUNET_PeerIdentity * peer, void *unused)
{
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "Entering peer_connect_handler:\n");
@@ -426,7 +540,7 @@
GNUNET_mutex_unlock (ctx->dvMutex);
addUpdateNeighbor (peer, NULL, cost);
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_mutex_lock (ctx->dvMutex);
print_tables ();
GNUNET_mutex_unlock (ctx->dvMutex);
@@ -443,7 +557,7 @@
struct GNUNET_dv_heap *root, void *cls)
{
GNUNET_PeerIdentity *toMatch = cls;
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_EncName encNeighbor;
GNUNET_EncName encReferrer;
GNUNET_EncName encToMatch;
@@ -495,7 +609,7 @@
{
struct GNUNET_dv_neighbor *neighbor;
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_EncName myself;
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
@@ -536,7 +650,7 @@
}
GNUNET_mutex_unlock (ctx->dvMutex);
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_mutex_lock (ctx->dvMutex);
print_tables ();
GNUNET_mutex_unlock (ctx->dvMutex);
@@ -563,7 +677,7 @@
if (ctx->neighbor_min_heap.size == 0)
return NULL;
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "Min heap size %d\nMax heap size %d\n",
@@ -577,7 +691,7 @@
static void *
neighbor_send_thread (void *rcls)
{
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
GNUNET_GE_BULK, "Entering neighbor_send_thread...\n");
@@ -603,7 +717,7 @@
&& (memcmp (about->neighbor, to->neighbor, sizeof (GNUNET_HashCode))
!= 0))
{
-#ifdef DEBUG_DV
+#if DEBUG_DV
GNUNET_hash_to_enc (&about->neighbor->hashPubKey, &encPeerAbout);
GNUNET_hash_to_enc (&to->neighbor->hashPubKey, &encPeerTo);
GNUNET_GE_LOG (coreAPI->ectx,
@@ -619,16 +733,10 @@
ctx->send_interval *
GNUNET_CRON_MILLISECONDS);
}
-
GNUNET_thread_sleep (ctx->send_interval * GNUNET_CRON_MILLISECONDS);
}
GNUNET_free (message);
-#ifdef DEBUG_DV
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK, "Exiting neighbor_send_thread...\n");
-#endif
return NULL;
}
@@ -722,7 +830,11 @@
void
done_module_dv ()
{
+ void *unused;
ctx->closing = 1;
+ GNUNET_thread_stop_sleep (sendingThread);
+ GNUNET_thread_join (sendingThread, &unused);
+
coreAPI->p2p_ciphertext_handler_unregister
(GNUNET_P2P_PROTO_DV_NEIGHBOR_MESSAGE, &p2pHandleDVNeighborMessage);
Modified: GNUnet/src/applications/dv/module/dv_heaptest.c
===================================================================
--- GNUnet/src/applications/dv/module/dv_heaptest.c 2009-02-27 01:02:26 UTC
(rev 8293)
+++ GNUnet/src/applications/dv/module/dv_heaptest.c 2009-02-27 22:52:14 UTC
(rev 8294)
@@ -32,7 +32,7 @@
#include "../../../util/crypto/hostkey_gcrypt.c"
#define MAX_SIZE 100
-#define TESTS 100
+#define TESTS 10
static int tempmaxsize;
static int tempminsize;
static int heapverify;
Added: GNUnet/src/applications/dv/module/dv_tbench.c
===================================================================
--- GNUnet/src/applications/dv/module/dv_tbench.c
(rev 0)
+++ GNUnet/src/applications/dv/module/dv_tbench.c 2009-02-27 22:52:14 UTC
(rev 8294)
@@ -0,0 +1,467 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001 - 2009 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file applications/dv/module/dv_tbench.c
+ * @author Nathan Evans
+ * @author Paul Ruth
+ * @brief module to enable dv specific transport profiling.
+ */
+
+#include "platform.h"
+#include "gnunet_protocols.h"
+#include "gnunet_dv_service.h"
+#include "dv_tbench.h"
+
+#define DEBUG_TBENCH GNUNET_NO
+
+typedef struct
+{
+ GNUNET_CronTime totalTime;
+ unsigned char *packetsReceived;
+ unsigned int maxPacketNumber;
+ unsigned int lossCount;
+ unsigned int duplicateCount;
+} IterationData;
+
+/**
+ * Message exchanged between peers for profiling
+ * transport performance.
+ */
+typedef struct
+{
+ GNUNET_MessageHeader header;
+ unsigned int iterationNum;
+ unsigned int packetNum;
+ unsigned int priority;
+ unsigned int nounce;
+ unsigned int crc;
+} P2P_tbench_MESSAGE;
+
+/**
+ * Lock for access to semaphores.
+ */
+static struct GNUNET_Mutex *lock;
+
+static struct GNUNET_Semaphore *postsem;
+
+/**
+ * What is the current iteration counter? (Used to verify
+ * that replies match the current request series).
+ */
+static unsigned int currIteration;
+
+static unsigned int currNounce;
+
+/**
+ * Did the current iteration time-out? (GNUNET_YES/GNUNET_NO)
+ */
+static int timeoutOccured;
+
+static struct GNUNET_GE_Context *ectx;
+
+static GNUNET_CoreAPIForPlugins *coreAPI;
+
+static GNUNET_DV_ServiceAPI *dvAPI;
+
+static IterationData *results;
+
+/**
+ * Did we receive the last response for the current iteration
+ * before the timeout? If so, when?
+ */
+static GNUNET_CronTime earlyEnd;
+
+
+/**
+ * Another peer sent us a tbench request. Just turn
+ * around and send it back.
+ */
+static int
+handleTBenchReq (const GNUNET_PeerIdentity * sender,
+ const GNUNET_MessageHeader * message)
+{
+ GNUNET_MessageHeader *reply;
+ const P2P_tbench_MESSAGE *msg;
+
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
+ "Received tbench request\n");
+#endif
+ if (ntohs (message->size) < sizeof (P2P_tbench_MESSAGE))
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return GNUNET_SYSERR;
+ }
+ msg = (const P2P_tbench_MESSAGE *) message;
+ if (GNUNET_crc32_n (&msg[1],
+ ntohs (message->size) - sizeof (P2P_tbench_MESSAGE))
+ != ntohl (msg->crc))
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return GNUNET_SYSERR;
+ }
+
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
+ "Received request %u from iteration %u/%u\n",
+ htonl (msg->packetNum),
+ htonl (msg->iterationNum), htonl (msg->nounce));
+#endif
+ reply = GNUNET_malloc (ntohs (message->size));
+ memcpy (reply, message, ntohs (message->size));
+ reply->type = htons (GNUNET_P2P_PROTO_TBENCH_REPLY);
+ dvAPI->dv_send(sender, reply);
+ //coreAPI->ciphertext_send (sender, reply, ntohl (msg->priority), 0); /*
no delay */
+ GNUNET_free (reply);
+ return GNUNET_OK;
+}
+
+/**
+ * We received a tbench-reply. Check and count stats.
+ */
+static int
+handleTBenchReply (const GNUNET_PeerIdentity * sender,
+ const GNUNET_MessageHeader * message)
+{
+ const P2P_tbench_MESSAGE *pmsg;
+ unsigned int lastPacketNumber;
+ IterationData *res;
+
+ if (ntohs (message->size) < sizeof (P2P_tbench_MESSAGE))
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return GNUNET_SYSERR;
+ }
+ pmsg = (const P2P_tbench_MESSAGE *) message;
+ if (GNUNET_crc32_n (&pmsg[1],
+ ntohs (message->size) - sizeof (P2P_tbench_MESSAGE))
+ != ntohl (pmsg->crc))
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_mutex_lock (lock);
+ if ((timeoutOccured == GNUNET_NO) &&
+ (postsem != NULL) &&
+ (htonl (pmsg->iterationNum) == currIteration) &&
+ (htonl (pmsg->nounce) == currNounce))
+ {
+ res = &results[currIteration];
+ lastPacketNumber = ntohl (pmsg->packetNum);
+ if (lastPacketNumber <= res->maxPacketNumber)
+ {
+ if (0 == res->packetsReceived[lastPacketNumber]++)
+ {
+ res->lossCount--;
+ if (res->lossCount == 0)
+ earlyEnd = GNUNET_get_time ();
+ }
+ else
+ {
+ res->duplicateCount++;
+ }
+ }
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
+ "Received response %u from iteration %u/%u on time!\n",
+ htonl (pmsg->packetNum),
+ htonl (pmsg->iterationNum), htonl (pmsg->nounce));
+#endif
+ }
+ else
+ {
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
+ "Received message %u from iteration %u too late (now at
iteration %u)\n",
+ ntohl (pmsg->packetNum),
+ ntohl (pmsg->iterationNum), currIteration);
+#endif
+ }
+ GNUNET_mutex_unlock (lock);
+ return GNUNET_OK;
+}
+
+/**
+ * Cron-job helper function to signal timeout.
+ */
+static void
+semaUp (void *cls)
+{
+ struct GNUNET_Semaphore *sem = cls;
+ timeoutOccured = GNUNET_YES;
+ GNUNET_semaphore_up (sem);
+}
+
+/**
+ * Handle client request (main function)
+ */
+static int
+csHandleTBenchRequest (struct GNUNET_ClientHandle *client,
+ const GNUNET_MessageHeader * message)
+{
+ CS_tbench_request_MESSAGE *msg;
+ CS_tbench_reply_MESSAGE reply;
+ P2P_tbench_MESSAGE *p2p;
+ unsigned short size;
+ unsigned int iteration;
+ unsigned int packetNum;
+ GNUNET_CronTime startTime;
+ GNUNET_CronTime endTime;
+ GNUNET_CronTime now;
+ GNUNET_CronTime delay;
+ unsigned long long sum_loss;
+ unsigned int max_loss;
+ unsigned int min_loss;
+ GNUNET_CronTime sum_time;
+ GNUNET_CronTime min_time;
+ GNUNET_CronTime max_time;
+ double sum_variance_time;
+ double sum_variance_loss;
+ unsigned int msgCnt;
+ unsigned int iterations;
+
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_BULK,
+ "Tbench received request from client.\n", msgCnt, size,
+ iterations);
+#endif
+ if (ntohs (message->size) != sizeof (CS_tbench_request_MESSAGE))
+ return GNUNET_SYSERR;
+
+ msg = (CS_tbench_request_MESSAGE *) message;
+ size = sizeof (P2P_tbench_MESSAGE) + ntohl (msg->msgSize);
+ if (size < sizeof (P2P_tbench_MESSAGE))
+ return GNUNET_SYSERR;
+ delay = GNUNET_ntohll (msg->intPktSpace);
+ iterations = ntohl (msg->iterations);
+ msgCnt = ntohl (msg->msgCnt);
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_BULK,
+ "Tbench runs %u test messages of size %u in %u iterations.\n",
+ msgCnt, size, iterations);
+#endif
+ GNUNET_mutex_lock (lock);
+ if (results != NULL)
+ {
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_IMMEDIATE,
+ "Cannot run multiple tbench sessions at the same
time!\n");
+ GNUNET_mutex_unlock (lock);
+ return GNUNET_SYSERR;
+ }
+ results = GNUNET_malloc (sizeof (IterationData) * iterations);
+
+ p2p = GNUNET_malloc (size);
+ memset (p2p, 0, size);
+ p2p->header.size = htons (size);
+ p2p->header.type = htons (GNUNET_P2P_PROTO_TBENCH_REQUEST);
+ p2p->priority = msg->priority;
+
+ for (iteration = 0; iteration < iterations; iteration++)
+ {
+ results[iteration].maxPacketNumber = msgCnt;
+ results[iteration].packetsReceived = GNUNET_malloc (msgCnt);
+ memset (results[iteration].packetsReceived, 0, msgCnt);
+ results[iteration].lossCount = msgCnt;
+ results[iteration].duplicateCount = 0;
+
+ earlyEnd = 0;
+ postsem = GNUNET_semaphore_create (0);
+ currNounce = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 0xFFFFFF);
+ p2p->nounce = htonl (currNounce);
+ currIteration = iteration;
+ p2p->iterationNum = htonl (currIteration);
+ memset (&p2p[1],
+ GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 256),
+ size - sizeof (P2P_tbench_MESSAGE));
+ p2p->crc =
+ htonl (GNUNET_crc32_n (&p2p[1], size - sizeof (P2P_tbench_MESSAGE)));
+ GNUNET_mutex_unlock (lock); /* allow receiving */
+
+ startTime = GNUNET_get_time ();
+ endTime = startTime + GNUNET_ntohll (msg->timeOut);
+
+ timeoutOccured = GNUNET_NO;
+ GNUNET_cron_add_job (coreAPI->cron,
+ &semaUp,
+ GNUNET_ntohll (msg->timeOut) *
+ GNUNET_CRON_MILLISECONDS, 0, postsem);
+ for (packetNum = 0; packetNum < msgCnt; packetNum++)
+ {
+ now = GNUNET_get_time ();
+ p2p->packetNum = htonl (packetNum);
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
+ "Sending message %u of size %u in iteration %u\n",
+ packetNum, size, iteration);
+#endif
+ dvAPI->dv_send(&msg->receiverId, &p2p->header);
+ //coreAPI->ciphertext_send (&msg->receiverId, &p2p->header, ntohl
(msg->priority), 0); /* no delay */
+ if ((delay != 0) &&
+ (htonl (msg->trainSize) != 0) &&
+ (packetNum % htonl (msg->trainSize)) == 0)
+ GNUNET_thread_sleep (delay);
+ }
+ GNUNET_semaphore_down (postsem, GNUNET_YES);
+ GNUNET_mutex_lock (lock);
+ if (earlyEnd == 0)
+ earlyEnd = GNUNET_get_time ();
+ results[iteration].totalTime = earlyEnd - startTime;
+ GNUNET_free (results[iteration].packetsReceived);
+ GNUNET_semaphore_destroy (postsem);
+ postsem = NULL;
+ }
+ GNUNET_mutex_unlock (lock);
+ GNUNET_free (p2p);
+#if DEBUG_TBENCH
+ GNUNET_GE_LOG (ectx,
+ GNUNET_GE_DEBUG | GNUNET_GE_BULK | GNUNET_GE_USER,
+ "Done waiting for response.\n", packetNum, size, iteration);
+#endif
+
+ sum_loss = 0;
+ sum_time = 0;
+ max_loss = 0;
+ min_loss = msgCnt;
+ min_time = 1 * GNUNET_CRON_YEARS;
+ max_time = 0;
+ /* data post-processing */
+ for (iteration = 0; iteration < iterations; iteration++)
+ {
+ sum_loss += results[iteration].lossCount;
+ sum_time += results[iteration].totalTime;
+
+ if (results[iteration].lossCount > max_loss)
+ max_loss = results[iteration].lossCount;
+ if (results[iteration].lossCount < min_loss)
+ min_loss = results[iteration].lossCount;
+ if (results[iteration].totalTime > max_time)
+ max_time = results[iteration].totalTime;
+ if (results[iteration].totalTime < min_time)
+ min_time = results[iteration].totalTime;
+ }
+
+ sum_variance_time = 0.0;
+ sum_variance_loss = 0.0;
+ for (iteration = 0; iteration < iterations; iteration++)
+ {
+ sum_variance_time +=
+ (results[iteration].totalTime - sum_time / iterations) *
+ (results[iteration].totalTime - sum_time / iterations);
+ sum_variance_loss +=
+ (results[iteration].lossCount - sum_loss / iterations) *
+ (results[iteration].lossCount - sum_loss / iterations);
+ }
+
+ /* send collected stats back to client */
+ reply.header.size = htons (sizeof (CS_tbench_reply_MESSAGE));
+ reply.header.type = htons (GNUNET_CS_PROTO_TBENCH_REPLY);
+ reply.max_loss = htonl (max_loss);
+ reply.min_loss = htonl (min_loss);
+ reply.mean_loss = ((float) sum_loss / (float) iterations);
+ reply.mean_time = ((float) sum_time / (float) iterations);
+ reply.max_time = GNUNET_htonll (max_time);
+ reply.min_time = GNUNET_htonll (min_time);
+ reply.variance_time = sum_variance_time / (iterations - 1);
+ reply.variance_loss = sum_variance_loss / (iterations - 1);
+ GNUNET_free (results);
+ results = NULL;
+ return coreAPI->cs_send_message (client, &reply.header, GNUNET_YES);
+}
+
+/**
+ * Initialize the dv_tbench module
+ *
+ * @return GNUNET_SYSERR on errors
+ */
+int
+initialize_module_dv_tbench (GNUNET_CoreAPIForPlugins * capi)
+{
+ int ok = GNUNET_OK;
+
+ ectx = capi->ectx;
+ lock = GNUNET_mutex_create (GNUNET_NO);
+ coreAPI = capi;
+ dvAPI = coreAPI->service_request("dv");
+
+ if (dvAPI == NULL)
+ {
+ GNUNET_GE_BREAK (ectx, 0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_GE_LOG (capi->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ _("`%s' registering P2P handlers %d, %d\n"),
+ "dv_tbench", GNUNET_P2P_PROTO_TBENCH_REPLY,
GNUNET_P2P_PROTO_TBENCH_REQUEST);
+
+ if (GNUNET_SYSERR ==
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_TBENCH_REPLY,
+ &handleTBenchReply))
+ ok = GNUNET_SYSERR;
+
+ if (GNUNET_SYSERR ==
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_TBENCH_REQUEST,
+ &handleTBenchReq))
+ ok = GNUNET_SYSERR;
+ GNUNET_GE_LOG (capi->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ _("`%s' registering CS handler %d\n"),
+ "dv_tbench", GNUNET_CS_PROTO_TBENCH_REQUEST);
+ if (GNUNET_SYSERR ==
+ capi->cs_handler_register (GNUNET_CS_PROTO_TBENCH_REQUEST,
+ &csHandleTBenchRequest))
+ ok = GNUNET_SYSERR;
+
+ GNUNET_GE_ASSERT (capi->ectx,
+ 0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
+ capi->ectx,
+ "ABOUT",
+ "dv_tbench",
+ gettext_noop
+ ("allows
profiling of dv "
+ "peer
connections")));
+ return ok;
+}
+
+void
+done_module_dv_tbench ()
+{
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_TBENCH_REQUEST,
+ &handleTBenchReq);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_TBENCH_REPLY,
+ &handleTBenchReply);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_TBENCH_REQUEST,
+ &csHandleTBenchRequest);
+ coreAPI->service_release(dvAPI);
+ GNUNET_mutex_destroy (lock);
+ lock = NULL;
+ coreAPI = NULL;
+}
+
+/* end of dv_tbench.c */
Added: GNUnet/src/applications/dv/module/dv_tbench.h
===================================================================
--- GNUnet/src/applications/dv/module/dv_tbench.h
(rev 0)
+++ GNUnet/src/applications/dv/module/dv_tbench.h 2009-02-27 22:52:14 UTC
(rev 8294)
@@ -0,0 +1,92 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file applications/dv/module/tbench.h
+ * @author Christian Grothoff
+ */
+#ifndef TBENCH_TBENCH_H
+#define TBENCH_TBENCH_H
+
+#include "gnunet_core.h"
+
+/**
+ * Client requests peer to perform some profiling.
+ */
+typedef struct
+{
+ GNUNET_MessageHeader header;
+ /**
+ * How big is each message (plus headers).
+ * Note that GNUnet is limited to 64k messages.
+ */
+ unsigned int msgSize GNUNET_PACKED;
+ /**
+ * How many messages should be transmitted in
+ * each iteration?
+ */
+ unsigned int msgCnt GNUNET_PACKED;
+ /**
+ * How many iterations should be performed?
+ */
+ unsigned int iterations GNUNET_PACKED;
+ /**
+ * Which peer should receive the messages?
+ */
+ GNUNET_PeerIdentity receiverId;
+ /**
+ * Inter packet space in milliseconds (delay
+ * introduced when sending messages).
+ */
+ GNUNET_CronTime intPktSpace GNUNET_PACKED;
+ /**
+ * Time to wait for the arrival of all repies
+ * in one iteration.
+ */
+ GNUNET_CronTime timeOut GNUNET_PACKED;
+ /**
+ * intPktSpace delay is only introduced every
+ * trainSize messages.
+ */
+ unsigned int trainSize GNUNET_PACKED;
+ /**
+ * Which priority should be used?
+ */
+ unsigned int priority GNUNET_PACKED;
+} CS_tbench_request_MESSAGE;
+
+/**
+ * Response from server with statistics.
+ */
+typedef struct
+{
+ GNUNET_MessageHeader header;
+ unsigned int max_loss GNUNET_PACKED;
+ unsigned int min_loss GNUNET_PACKED;
+ float mean_loss GNUNET_PACKED;
+ float variance_loss GNUNET_PACKED;
+
+ GNUNET_CronTime max_time GNUNET_PACKED;
+ GNUNET_CronTime min_time GNUNET_PACKED;
+ float mean_time GNUNET_PACKED;
+ float variance_time GNUNET_PACKED;
+} CS_tbench_reply_MESSAGE;
+
+#endif
Added: GNUnet/src/applications/dv/module/dv_test.conf
===================================================================
--- GNUnet/src/applications/dv/module/dv_test.conf
(rev 0)
+++ GNUnet/src/applications/dv/module/dv_test.conf 2009-02-27 22:52:14 UTC
(rev 8294)
@@ -0,0 +1,6 @@
+[MULTIPLE_SERVER_TESTING]
+CONTROL_HOST=127.0.0.0/8;
+HOSTNAMES=localhost
+STARTING_PORT=31387
+PORT_INCREMENT=2
+BASE_CONFIG=gnunetd_dv.conf
Added: GNUnet/src/applications/dv/module/dvtest.c
===================================================================
--- GNUnet/src/applications/dv/module/dvtest.c (rev 0)
+++ GNUnet/src/applications/dv/module/dvtest.c 2009-02-27 22:52:14 UTC (rev
8294)
@@ -0,0 +1,188 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2004, 2005, 2006 Christian Grothoff (and other
contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file applications/dv/dvtest.c
+ * @brief DV Transport testing tool
+ * @author Nathan EVans
+ */
+
+#include "platform.h"
+#include "gnunet_protocols.h"
+#include "gnunet_stats_lib.h"
+#include "gnunet_testing_lib.h"
+#include "gnunet_util.h"
+#include "dv_tbench.h"
+#include "gnunet_remote_lib.h"
+#include "gnunet_directories.h"
+
+#define START_PEERS 1
+
+static struct GNUNET_REMOTE_TESTING_DaemonContext *peer1;
+static struct GNUNET_REMOTE_TESTING_DaemonContext *peer2;
+static struct GNUNET_REMOTE_TESTING_DaemonContext *peer3;
+static struct GNUNET_REMOTE_TESTING_DaemonContext *peer4;
+static struct GNUNET_REMOTE_TESTING_DaemonContext *peer5;
+static struct GNUNET_REMOTE_TESTING_DaemonContext *peer6;
+
+static int
+test (struct GNUNET_ClientServerConnection *sock,
+ unsigned int messageSize,
+ unsigned int messageCnt,
+ unsigned int messageIterations,
+ GNUNET_CronTime messageSpacing,
+ unsigned int messageTrainSize,
+ GNUNET_CronTime messageTimeOut,
+ GNUNET_PeerIdentity receiver/* in milli-seconds */ )
+{
+ int ret;
+ CS_tbench_request_MESSAGE msg;
+ CS_tbench_reply_MESSAGE *buffer;
+ float messagesPercentLoss;
+
+ printf (_("Using %u messages of size %u for %u times.\n"),
+ messageCnt, messageSize, messageIterations);
+ msg.header.size = htons (sizeof (CS_tbench_request_MESSAGE));
+ msg.header.type = htons (GNUNET_CS_PROTO_TBENCH_REQUEST);
+ msg.msgSize = htonl (messageSize);
+ msg.msgCnt = htonl (messageCnt);
+ msg.iterations = htonl (messageIterations);
+ msg.intPktSpace = GNUNET_htonll (messageSpacing);
+ msg.trainSize = htonl (messageTrainSize);
+ msg.timeOut = GNUNET_htonll (messageTimeOut);
+ msg.priority = htonl (5);
+ msg.receiverId = receiver;
+
+ if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &msg.header))
+ return -1;
+ ret = 0;
+
+ buffer = NULL;
+ if (GNUNET_OK ==
+ GNUNET_client_connection_read (sock,
+ (GNUNET_MessageHeader **) & buffer))
+ {
+ if ((float) buffer->mean_loss <= 0)
+ {
+ messagesPercentLoss = 0.0;
+ }
+ else
+ {
+ messagesPercentLoss =
+ (buffer->mean_loss / ((float) htons (msg.msgCnt)));
+ }
+ printf (_
+ ("Times: max %16llu min %16llu mean %12.3f variance
%12.3f\n"),
+ GNUNET_ntohll (buffer->max_time),
+ GNUNET_ntohll (buffer->min_time), buffer->mean_time,
+ buffer->variance_time);
+ printf (_("Loss: max %16u min %16u mean %12.3f variance %12.3f\n"),
+ ntohl (buffer->max_loss), ntohl (buffer->min_loss),
+ buffer->mean_loss, buffer->variance_loss);
+ }
+ else
+ {
+ printf (_("\nFailed to receive reply from gnunetd.\n"));
+ ret = -1;
+ }
+ GNUNET_free_non_null (buffer);
+
+ return ret;
+}
+
+/**
+ * Testcase to test DV communications.
+ *
+ * @param argc number of arguments from the command line
+ * @param argv command line arguments
+ * @return 0: ok, -1: error
+ */
+int
+main (int argc, char **argv)
+{
+#if START_PEERS
+ struct GNUNET_REMOTE_TESTING_DaemonContext *peers;
+ struct GNUNET_REMOTE_TESTING_DaemonContext *pos;
+#endif
+ int i;
+ int ret;
+ struct GNUNET_ClientServerConnection *sock;
+ struct GNUNET_GC_Configuration *cfg;
+
+ ret = 0;
+ cfg = GNUNET_GC_create ();
+ if (-1 == GNUNET_GC_parse_configuration (cfg, "dv_test.conf"))
+ {
+ GNUNET_GC_free (cfg);
+ return -1;
+ }
+#if START_PEERS
+ peers =
+ GNUNET_REMOTE_start_daemons (cfg, 6);
+ if (peers == NULL)
+ {
+ GNUNET_GC_free (cfg);
+ return -1;
+ }
+#endif
+ peer1 = peers;
+ peer2 = peer1->next;
+ peer3 = peer2->next;
+ peer4 = peer3->next;
+ peer5 = peer4->next;
+ peer6 = peer5->next;
+
+ sock = GNUNET_client_connection_create (NULL, peers->config);
+
+ /* 'slow' pass: wait for bandwidth negotiation! */
+ printf (_("Sleeping 5 seconds to let topology stabilize...\n"));
+ sleep(5);
+ printf (_("Running benchmark...\n"));
+ if (ret == 0)
+ ret =
+ test (sock, 64, 100, 1, 500 * GNUNET_CRON_MILLISECONDS, 1,
+ 15 * GNUNET_CRON_SECONDS, *peer2->peer);
+ if (ret == 0)
+ ret =
+ test (sock, 64, 100, 1, 50 * GNUNET_CRON_MILLISECONDS, 1,
+ 5 * GNUNET_CRON_SECONDS, *peer3->peer);
+
+ if (ret == 0)
+ ret =
+ test (sock, 64, 100, 1, 50 * GNUNET_CRON_MILLISECONDS, 1,
+ 5 * GNUNET_CRON_SECONDS, *peer5->peer);
+
+ GNUNET_client_connection_destroy (sock);
+#if START_PEERS
+ /*FIXME: Have GNUNET_REMOTE_TESTING_stop_daemons...
GNUNET_TESTING_stop_daemons (peers);*/
+ pos = peers;
+ while(pos != NULL)
+ {
+ GNUNET_REMOTE_kill_daemon(pos);
+ pos = pos->next;
+ }
+#endif
+
+ GNUNET_GC_free (cfg);
+ return ret;
+}
+
+/* end of dvtest.c */
+
Added: GNUnet/src/applications/dv/module/gnunetd_dv.conf
===================================================================
--- GNUnet/src/applications/dv/module/gnunetd_dv.conf
(rev 0)
+++ GNUnet/src/applications/dv/module/gnunetd_dv.conf 2009-02-27 22:52:14 UTC
(rev 8294)
@@ -0,0 +1,98 @@
+[Meta]
+ADVANCED = YES
+EXPERIMENTAL = YES
+
+[PATHS]
+GNUNETD_HOME =
+
+[GNUNETD]
+APPLICATIONS = advertising getoption stats tracekit dv_tbench dv
+TRANSPORTS = udp tcp nat
+HOSTS = $GNUNETD_HOME/data/hosts/
+HTTP-PROXY =
+FDLIMIT = 1024
+PIDFILE = $GNUNETD_HOME/pid/
+AUTOSTART = NO
+HELLOEXPIRES = 1440
+PRIVATE-NETWORK = NO
+LIMIT-ALLOW =
+LIMIT-DENY =
+KEEPLOG = 3
+LOGFILE = $GNUNETD_HOME/daemon-logs
+
+[MODULES]
+sqstore = sqstore_sqlite
+dstore = dstore_sqlite
+topology = topology_default
+
+[NETWORK]
+PORT = 2087
+TRUSTED = 127.0.0.0/8;
+DISABLE-ADVERTISEMENTS = NO
+HELLOEXCHANGE = YES
+DISABLE-AUTOCONNECT = NO
+INTERFACE = eth1
+
+[F2F]
+FRIENDS-ONLY = YES
+#MINIMUM = 0
+FRIENDS = $GNUNETD_HOME/friends
+
+[FS]
+DIR = $GNUNETD_HOME/data/fs
+INDEX-DIRECTORY = $GNUNETD_HOME/data/shared
+QUOTA = 1024
+ACTIVEMIGRATION = NO
+
+[TCPSERVER]
+DISABLE = NO
+
+[LOGGING]
+DEVELOPER = YES
+USER-LEVEL = DEBUG
+ADMIN-LEVEL = DEBUG
+
+[LOAD]
+MAXNETDOWNBPSTOTAL = 50000
+MAXNETUPBPSTOTAL = 50000
+HARDUPLIMIT = 0
+MAXCPULOAD = 100
+MAXIOLOAD = 50
+HARDCPULIMIT = 0
+BASICLIMITING = YES
+INTERFACES = eth0
+
+[GNUNETD-EXPERIMENTAL]
+PADDING = NO
+
+[NAT]
+LIMITED = AUTO
+
+[TCP]
+PORT = 2086
+UPNP = YES
+BLACKLIST =
+WHITELIST =
+
+[UDP]
+PORT = 2086
+UPNP = YES
+MTU = 1472
+BLACKLIST =
+WHITELIST =
+
+[GAP]
+TABLESIZE = 65536
+
+[DHT]
+TABLESIZE = 1024
+
+[DSTORE]
+QUOTA = 1
+
+[MYSQL]
+CONFIG = /etc/my.cnf
+DATABASE = gnunet
+
+[TESTING]
+WEAKRANDOM = YES
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8294 - GNUnet/src/applications/dv/module,
gnunet <=