[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9782 - GNUnet/src/applications/dv/module
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9782 - GNUnet/src/applications/dv/module |
Date: |
Wed, 16 Dec 2009 21:44:59 +0100 |
Author: nevans
Date: 2009-12-16 21:44:59 +0100 (Wed, 16 Dec 2009)
New Revision: 9782
Modified:
GNUnet/src/applications/dv/module/dv.c
GNUnet/src/applications/dv/module/dv_heaptest.c
GNUnet/src/applications/dv/module/dv_test.conf
GNUnet/src/applications/dv/module/dvtest.c
Log:
dvtest now returns badly if messages don't get through
Modified: GNUnet/src/applications/dv/module/dv.c
===================================================================
--- GNUnet/src/applications/dv/module/dv.c 2009-12-16 14:45:05 UTC (rev
9781)
+++ GNUnet/src/applications/dv/module/dv.c 2009-12-16 20:44:59 UTC (rev
9782)
@@ -117,7 +117,7 @@
if (stats == NULL)
return;
stats->set (stat_dv_total_peers,
- GNUNET_multi_hash_map_size (ctx->extended_neighbors));
+ GNUNET_multi_hash_map_size (ctx->extended_neighbors));
#if DEBUG_PEERS
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
@@ -225,7 +225,7 @@
GNUNET_mutex_lock (ctx->dvMutex);
ret = GNUNET_multi_hash_map_contains (ctx->extended_neighbors,
- &peer->hashPubKey);
+ &peer->hashPubKey);
GNUNET_mutex_unlock (ctx->dvMutex);
return ret;
}
@@ -256,7 +256,7 @@
static unsigned int
-get_peer_id (const GNUNET_PeerIdentity *peer)
+get_peer_id (const GNUNET_PeerIdentity * peer)
{
struct GNUNET_dv_neighbor *neighbor;
#if DEBUG_DV_FORWARD
@@ -266,7 +266,7 @@
if (GNUNET_YES ==
GNUNET_multi_hash_map_contains (ctx->extended_neighbors,
- &peer->hashPubKey))
+ &peer->hashPubKey))
{
neighbor =
GNUNET_multi_hash_map_get (ctx->extended_neighbors,
@@ -274,13 +274,13 @@
return neighbor->neighbor_id;
}
#if DEBUG_DV_FORWARD
- GNUNET_hash_to_enc (&coreAPI->my_identity->hashPubKey, &encMe);
- GNUNET_hash_to_enc (&peer->hashPubKey, &enc);
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK,
- "%s: I AM:\n%s\nCould not find peer:\n%s\n\n",
- &shortID, (char *) &encMe, (char *) &enc);
+ GNUNET_hash_to_enc (&coreAPI->my_identity->hashPubKey, &encMe);
+ GNUNET_hash_to_enc (&peer->hashPubKey, &enc);
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "%s: I AM:\n%s\nCould not find peer:\n%s\n\n",
+ &shortID, (char *) &encMe, (char *) &enc);
#endif
if (stats != NULL)
stats->change (stat_dv_unknown_peer, 1);
@@ -318,24 +318,26 @@
GNUNET_mutex_lock (ctx->dvMutex);
if (GNUNET_YES ==
- GNUNET_multi_hash_map_contains (ctx->direct_neighbors,
- &recipient->hashPubKey))
- {
- recipient_id = 0;
- }
+ GNUNET_multi_hash_map_contains (ctx->direct_neighbors,
+ &recipient->hashPubKey))
+ {
+ recipient_id = 0;
+ }
else
- {
- recipient_id = get_peer_id (recipient);
- }
+ {
+ recipient_id = get_peer_id (recipient);
+ }
if (memcmp
(&coreAPI->my_identity->hashPubKey, &original_sender->hashPubKey,
sizeof (GNUNET_HashCode)) == 0)
{
#if DEBUG_DV_FORWARD
- GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK, "%s: In send_message, origin and me are
the same!\n", &shortID);
+ GNUNET_GE_BULK,
+ "%s: In send_message, origin and me are the same!\n",
+ &shortID);
#endif
original_sender_id = 0;
}
@@ -344,44 +346,42 @@
original_sender_id = get_peer_id (original_sender);
}
- if ( (GNUNET_SYSERR == recipient_id) ||
- (GNUNET_SYSERR == original_sender_id) )
+ if ((GNUNET_SYSERR == recipient_id) ||
+ (GNUNET_SYSERR == original_sender_id))
{
GNUNET_mutex_unlock (ctx->dvMutex);
if (original_sender_id == GNUNET_SYSERR)
- {
+ {
#if DEBUG_DV_FORWARD
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK,
- "%s: Original sender unknown\n",
- &shortID);
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
+ | GNUNET_GE_BULK, "%s: Original sender unknown\n",
+ &shortID);
#endif
- }
+ }
else if (recipient_id == GNUNET_SYSERR)
- {
+ {
#if DEBUG_DV_FORWARD
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK,
- "%s: Recipient unknown\n",
- &shortID);
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
+ | GNUNET_GE_BULK, "%s: Recipient unknown\n",
+ &shortID);
#endif
- }
+ }
return GNUNET_SYSERR;
}
#if DEBUG_DV_FORWARD
GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK,
- "%s: In send message, sender id is %d, recipient id is %d\n",
- &shortID, original_sender_id, recipient_id);
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK,
+ "%s: In send message, sender id is %d, recipient id is %d\n",
+ &shortID, original_sender_id, recipient_id);
#endif
neighbor =
GNUNET_multi_hash_map_get (ctx->extended_neighbors,
- &recipient->hashPubKey);
+ &recipient->hashPubKey);
GNUNET_GE_ASSERT (NULL, neighbor != NULL);
cost = neighbor->cost;
toSend = GNUNET_malloc (msg_size);
@@ -394,34 +394,32 @@
GNUNET_hash_to_enc (&original_sender->hashPubKey, &encMe);
GNUNET_hash_to_enc (&recipient->hashPubKey, &encRecipient);
GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK, "%s: Cost to intended peer is %d\n",
- &shortID, neighbor->cost);
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK, "%s: Cost to intended peer is %d\n",
+ &shortID, neighbor->cost);
if (neighbor->referrer != NULL)
{
GNUNET_hash_to_enc (&neighbor->referrer->hashPubKey, &encVia);
GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
- | GNUNET_GE_BULK,
- "%s: Original Sender:\n%s\nMessage intended
for:\n%s\nSending via:\n%s\n\n",
- &shortID, (char *) &encMe, (char *) &encRecipient,
- (char *) &encVia);
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
+ | GNUNET_GE_BULK,
+ "%s: Original Sender:\n%s\nMessage intended
for:\n%s\nSending via:\n%s\n\n",
+ &shortID, (char *) &encMe, (char *) &encRecipient,
+ (char *) &encVia);
}
else
{
GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
- | GNUNET_GE_BULK,
- "%s: Original Sender:\n%s\nMessage intended
for:\n%s\nSending Direct.\n",
- &shortID, (char *) &encMe, (char *) &encRecipient);
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
+ | GNUNET_GE_BULK,
+ "%s: Original Sender:\n%s\nMessage intended
for:\n%s\nSending Direct.\n",
+ &shortID, (char *) &encMe, (char *) &encRecipient);
}
#endif
coreAPI->ciphertext_send ((neighbor->referrer != NULL)
- ? neighbor->referrer
- : neighbor->neighbor,
- &toSend->header,
- importance,
- maxdelay);
+ ? neighbor->referrer
+ : neighbor->neighbor,
+ &toSend->header, importance, maxdelay);
if (stats != NULL)
stats->change (stat_dv_actual_sent_messages, 1);
GNUNET_free (toSend);
@@ -449,7 +447,7 @@
int ret;
int i;
const GNUNET_MessageHeader *packed_message =
- (const GNUNET_MessageHeader *) & message[1];
+ (const GNUNET_MessageHeader *) &message[1];
if ((ntohs (message->header.size) < sizeof (p2p_dv_MESSAGE_Data))
|| (ntohs (message->header.size) !=
@@ -475,7 +473,7 @@
{
memcpy (&recipient, &ctx->neighbor_id_array[i].identity,
sizeof (GNUNET_PeerIdentity));
- ret = GNUNET_OK;
+ ret = GNUNET_OK;
break;
}
}
@@ -496,8 +494,7 @@
(char *) &encOrigin);
#endif
return send_message (&recipient,
- sender,
- packed_message, DV_PRIORITY, DV_DELAY);
+ sender, packed_message, DV_PRIORITY, DV_DELAY);
}
/*
@@ -515,10 +512,9 @@
GNUNET_EncName encOrigin;
unsigned int message_length;
#endif
- const p2p_dv_MESSAGE_Data *incoming
- = (const p2p_dv_MESSAGE_Data *) message;
+ const p2p_dv_MESSAGE_Data *incoming = (const p2p_dv_MESSAGE_Data *) message;
const GNUNET_MessageHeader *packed_message
- = (const GNUNET_MessageHeader *) & incoming[1];
+ = (const GNUNET_MessageHeader *) &incoming[1];
GNUNET_PeerIdentity original_sender;
int ret;
int i;
@@ -592,53 +588,52 @@
}
}
if (ret == GNUNET_SYSERR)
- {
- GNUNET_mutex_unlock (ctx->dvMutex);
- #if DEBUG_DV_FORWARD
- GNUNET_hash_to_enc (&coreAPI->my_identity->hashPubKey, &encMe);
- GNUNET_hash_to_enc (&sender->hashPubKey, &encSender);
- GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK,
- "%s: Received message:\nI am:\n%s\nImmediate sender:\n%s\nOriginal
Sender UNKNOWN\n",
- &shortID, (char *) &encMe, (char *) &encSender);
+ {
+ GNUNET_mutex_unlock (ctx->dvMutex);
+#if DEBUG_DV_FORWARD
+ GNUNET_hash_to_enc (&coreAPI->my_identity->hashPubKey, &encMe);
+ GNUNET_hash_to_enc (&sender->hashPubKey, &encSender);
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
+ | GNUNET_GE_BULK,
+ "%s: Received message:\nI am:\n%s\nImmediate
sender:\n%s\nOriginal Sender UNKNOWN\n",
+ &shortID, (char *) &encMe, (char *) &encSender);
- #endif
- if (stats != NULL)
- stats->change (stat_dv_unknown_peer, 1);
- return GNUNET_SYSERR;
- }
+#endif
+ if (stats != NULL)
+ stats->change (stat_dv_unknown_peer, 1);
+ return GNUNET_SYSERR;
+ }
}
GNUNET_mutex_unlock (ctx->dvMutex);
if (ntohl (incoming->recipient) == 0)
{
coreAPI->loopback_send (&original_sender,
- (const char *) packed_message,
- ntohs (packed_message->size), GNUNET_YES,
- NULL);
+ (const char *) packed_message,
+ ntohs (packed_message->size), GNUNET_YES, NULL);
#if DEBUG_DV_FORWARD
GNUNET_hash_to_enc (&coreAPI->my_identity->hashPubKey, &encMe);
GNUNET_hash_to_enc (&sender->hashPubKey, &encSender);
GNUNET_hash_to_enc (&original_sender.hashPubKey, &encOrigin);
GNUNET_GE_LOG (coreAPI->ectx,
- GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
- | GNUNET_GE_BULK,
- "%s: Received message for me:\nI am:\n%s\nImmediate
sender:\n%s\nOriginal Sender:\n%s\n",
- &shortID, (char *) &encMe, (char *) &encSender,
- (char *) &encOrigin);
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
+ | GNUNET_GE_BULK,
+ "%s: Received message for me:\nI am:\n%s\nImmediate
sender:\n%s\nOriginal Sender:\n%s\n",
+ &shortID, (char *) &encMe, (char *) &encSender,
+ (char *) &encOrigin);
#endif
}
else
{
ret = forward_message (incoming, &original_sender);
if (stats != NULL)
- {
- if (ret != GNUNET_SYSERR)
- stats->change (stat_dv_forwarded_messages, 1);
- else
- stats->change (stat_dv_failed_forwards, 1);
- }
+ {
+ if (ret != GNUNET_SYSERR)
+ stats->change (stat_dv_forwarded_messages, 1);
+ else
+ stats->change (stat_dv_failed_forwards, 1);
+ }
}
return ret;
}
@@ -694,9 +689,9 @@
{
ret = GNUNET_OK;
if (bpm != NULL)
- *bpm = 0; /* FIXME */
+ *bpm = 0; /* FIXME */
if (last_seen != NULL)
- *last_seen = 0; /* FIXME */
+ *last_seen = 0; /* FIXME */
}
GNUNET_mutex_unlock (ctx->dvMutex);
return ret;
@@ -772,8 +767,8 @@
#if DEBUG_DV_MAINTAIN
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
- GNUNET_GE_BULK, "Node cost %d too high, not adding this
peer!\n",
- cost);
+ GNUNET_GE_BULK,
+ "Node cost %d too high, not adding this peer!\n", cost);
#endif
if ((GNUNET_YES ==
GNUNET_multi_hash_map_contains (ctx->extended_neighbors,
@@ -800,17 +795,17 @@
}
if (GNUNET_NO ==
GNUNET_multi_hash_map_contains (ctx->extended_neighbors,
- &peer->hashPubKey))
+ &peer->hashPubKey))
{
/* new neighbor */
if (ctx->max_table_size <=
GNUNET_multi_hash_map_size (ctx->extended_neighbors))
- {
- /* don't care, have plenty */
- /* FIXME: might want to consider cost here! */
- GNUNET_mutex_unlock (ctx->dvMutex);
- return GNUNET_OK;
- }
+ {
+ /* don't care, have plenty */
+ /* FIXME: might want to consider cost here! */
+ GNUNET_mutex_unlock (ctx->dvMutex);
+ return GNUNET_OK;
+ }
neighbor = GNUNET_malloc (sizeof (struct GNUNET_dv_neighbor));
neighbor->cost = cost;
neighbor->last_activity = now;
@@ -820,50 +815,44 @@
addToNeighborMap (neighbor_id, peer);
if (referrer == NULL)
- neighbor->referrer = NULL;
+ neighbor->referrer = NULL;
else
- {
- neighbor->referrer =
- GNUNET_malloc (sizeof (GNUNET_PeerIdentity));
- memcpy (neighbor->referrer, referrer,
- sizeof (GNUNET_PeerIdentity));
- }
+ {
+ neighbor->referrer = GNUNET_malloc (sizeof (GNUNET_PeerIdentity));
+ memcpy (neighbor->referrer, referrer, sizeof (GNUNET_PeerIdentity));
+ }
GNUNET_multi_hash_map_put (ctx->extended_neighbors,
- &peer->hashPubKey, neighbor,
- GNUNET_MultiHashMapOption_REPLACE);
+ &peer->hashPubKey, neighbor,
+ GNUNET_MultiHashMapOption_REPLACE);
- GNUNET_CONTAINER_heap_insert (ctx->neighbor_max_heap, neighbor,
- cost);
- GNUNET_CONTAINER_heap_insert (ctx->neighbor_min_heap, neighbor,
- cost);
+ GNUNET_CONTAINER_heap_insert (ctx->neighbor_max_heap, neighbor, cost);
+ GNUNET_CONTAINER_heap_insert (ctx->neighbor_min_heap, neighbor, cost);
if (stats != NULL)
- stats->change (stat_dv_total_peers, 1);
+ stats->change (stat_dv_total_peers, 1);
GNUNET_mutex_unlock (ctx->dvMutex);
return GNUNET_OK;
}
neighbor =
- GNUNET_multi_hash_map_get (ctx->extended_neighbors,
- &peer->hashPubKey);
+ GNUNET_multi_hash_map_get (ctx->extended_neighbors, &peer->hashPubKey);
if ((((neighbor->referrer == NULL) && (referrer == NULL)) ||
(((neighbor->referrer != NULL) && (referrer != NULL))
- &&
- (memcmp
- (neighbor->referrer, referrer,
- sizeof (GNUNET_PeerIdentity)) == 0))))
+ &&
+ (memcmp
+ (neighbor->referrer, referrer, sizeof (GNUNET_PeerIdentity)) == 0))))
{
/* same path as the one we already have */
neighbor->last_activity = now;
if (neighbor->cost != cost)
- {
- /* update cost */
- neighbor->cost = cost;
- GNUNET_CONTAINER_heap_update_cost (ctx->neighbor_max_heap, neighbor,
- cost);
- GNUNET_CONTAINER_heap_update_cost (ctx->neighbor_min_heap, neighbor,
- cost);
- }
+ {
+ /* update cost */
+ neighbor->cost = cost;
+ GNUNET_CONTAINER_heap_update_cost (ctx->neighbor_max_heap, neighbor,
+ cost);
+ GNUNET_CONTAINER_heap_update_cost (ctx->neighbor_min_heap, neighbor,
+ cost);
+ }
GNUNET_mutex_unlock (ctx->dvMutex);
return GNUNET_OK;
}
@@ -887,20 +876,16 @@
neighbor->referrer = NULL;
else
{
- neighbor->referrer =
- GNUNET_malloc (sizeof (GNUNET_PeerIdentity));
- memcpy (neighbor->referrer, referrer,
- sizeof (GNUNET_PeerIdentity));
+ neighbor->referrer = GNUNET_malloc (sizeof (GNUNET_PeerIdentity));
+ memcpy (neighbor->referrer, referrer, sizeof (GNUNET_PeerIdentity));
}
GNUNET_multi_hash_map_put (ctx->extended_neighbors,
- &peer->hashPubKey, neighbor,
- GNUNET_MultiHashMapOption_REPLACE);
+ &peer->hashPubKey, neighbor,
+ GNUNET_MultiHashMapOption_REPLACE);
- GNUNET_CONTAINER_heap_insert (ctx->neighbor_max_heap, neighbor,
- cost);
- GNUNET_CONTAINER_heap_insert (ctx->neighbor_min_heap, neighbor,
- cost);
+ GNUNET_CONTAINER_heap_insert (ctx->neighbor_max_heap, neighbor, cost);
+ GNUNET_CONTAINER_heap_insert (ctx->neighbor_min_heap, neighbor, cost);
#if DEBUG_DV
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
@@ -1053,12 +1038,12 @@
0)))
{
/* FIXME: we might want to have some way to notify the rest of
- our DV-neigborhood about this disconnect as well... */
+ our DV-neigborhood about this disconnect as well... */
delete_neighbor (neighbor);
/* we must not continue iterating at this point since
- 'delete_neighbor' modified the tree and hence internal
- invariants of the iterator were likely broken!
- Besides, each neighbor should only appear once anyway... */
+ 'delete_neighbor' modified the tree and hence internal
+ invariants of the iterator were likely broken!
+ Besides, each neighbor should only appear once anyway... */
return GNUNET_NO;
}
return GNUNET_YES;
@@ -1099,14 +1084,14 @@
GNUNET_multi_hash_map_get (ctx->direct_neighbors, &peer->hashPubKey);
if (neighbor != NULL)
{
- GNUNET_multi_hash_map_remove_all (ctx->direct_neighbors,
- &peer->hashPubKey);
- GNUNET_CONTAINER_heap_iterate (ctx->neighbor_max_heap,
- &delete_callback, (void*) peer);
+ GNUNET_multi_hash_map_remove_all (ctx->direct_neighbors,
+ &peer->hashPubKey);
+ GNUNET_CONTAINER_heap_iterate (ctx->neighbor_max_heap,
+ &delete_callback, (void *) peer);
/* Note that we do not use delete_neighbor here because
- we are deleting from the direct neighbor list! */
+ we are deleting from the direct neighbor list! */
GNUNET_free (neighbor->neighbor);
- GNUNET_free_non_null (neighbor->referrer);
+ GNUNET_free_non_null (neighbor->referrer);
GNUNET_free (neighbor);
}
}
@@ -1323,8 +1308,8 @@
GNUNET_GE_BULK,
_("%s: `%s' registering P2P handlers %d %d\n"),
"dv", &shortID,
- GNUNET_P2P_PROTO_DV_DATA_MESSAGE,
- GNUNET_P2P_PROTO_DV_NEIGHBOR_MESSAGE);
+ GNUNET_P2P_PROTO_DV_DATA_MESSAGE,
+ GNUNET_P2P_PROTO_DV_NEIGHBOR_MESSAGE);
GNUNET_GC_get_configuration_value_number (coreAPI->cfg,
Modified: GNUnet/src/applications/dv/module/dv_heaptest.c
===================================================================
--- GNUnet/src/applications/dv/module/dv_heaptest.c 2009-12-16 14:45:05 UTC
(rev 9781)
+++ GNUnet/src/applications/dv/module/dv_heaptest.c 2009-12-16 20:44:59 UTC
(rev 9782)
@@ -33,7 +33,6 @@
#define MAX_SIZE 100
#define TESTS 75
-
int
main (int argc, char **argv)
{
@@ -63,7 +62,7 @@
temp_rand = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 5);
while ((cur_pos <= 1) && (temp_rand != 0))
temp_rand = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 5);
- fprintf(stderr, "size is %d\n", GNUNET_CONTAINER_heap_get_size(minHeap));
+
switch (temp_rand)
{
case 0:
Modified: GNUnet/src/applications/dv/module/dv_test.conf
===================================================================
--- GNUnet/src/applications/dv/module/dv_test.conf 2009-12-16 14:45:05 UTC
(rev 9781)
+++ GNUnet/src/applications/dv/module/dv_test.conf 2009-12-16 20:44:59 UTC
(rev 9782)
@@ -4,5 +4,5 @@
STARTING_PORT=31387
PORT_INCREMENT=2
BASE_CONFIG=gnunetd_dv.conf
-TOPOLOGY=1
+TOPOLOGY=2
PERCENTAGE=.45
Modified: GNUnet/src/applications/dv/module/dvtest.c
===================================================================
--- GNUnet/src/applications/dv/module/dvtest.c 2009-12-16 14:45:05 UTC (rev
9781)
+++ GNUnet/src/applications/dv/module/dvtest.c 2009-12-16 20:44:59 UTC (rev
9782)
@@ -36,6 +36,8 @@
#define START_PEERS 1
#define NUM_RUNS 2
+static unsigned int sent_messages;
+static unsigned int failed_messages;
static struct GNUNET_REMOTE_TESTING_DaemonContext *peer1;
static struct GNUNET_REMOTE_TESTING_DaemonContext *peer2;
static struct GNUNET_REMOTE_TESTING_DaemonContext *peer3;
@@ -81,6 +83,7 @@
msg.timeOut = GNUNET_htonll (messageTimeOut);
msg.priority = htonl (5);
msg.receiverId = receiver;
+ sent_messages += messageCnt * messageIterations;
if (GNUNET_SYSERR == GNUNET_client_connection_write (sock, &msg.header))
return -1;
@@ -108,6 +111,7 @@
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);
+ failed_messages += ntohl (buffer->max_loss);
}
else
{
@@ -233,9 +237,17 @@
ret =
test (sock, 64, 5, 5, 50 * GNUNET_CRON_MILLISECONDS, 1,
5 * GNUNET_CRON_SECONDS, *peer7->peer);
- sleep (60);
+ sleep (10);
}
GNUNET_client_connection_destroy (sock);
+
+ fprintf (stdout,
+ "Total messages sent: %u, total failed %u, %1.2f percent success\n",
+ sent_messages, failed_messages,
+ ((sent_messages - failed_messages) / (float) sent_messages) * 100);
+ if (((sent_messages - failed_messages) / (float) sent_messages) * 100 <
+ 40.0)
+ ret = 1;
#if START_PEERS
/*FIXME: Have GNUNET_REMOTE_TESTING_stop_daemons...
GNUNET_TESTING_stop_daemons (peers); */
pos = peers;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9782 - GNUnet/src/applications/dv/module,
gnunet <=