[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13888 - gnunet/src/dv
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13888 - gnunet/src/dv |
Date: |
Tue, 7 Dec 2010 18:18:53 +0100 |
Author: nevans
Date: 2010-12-07 18:18:53 +0100 (Tue, 07 Dec 2010)
New Revision: 13888
Modified:
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/dv/test_transport_api_dv.c
gnunet/src/dv/test_transport_dv_data.conf
Log:
fixes for DV with new transport distance and core changes over the past few
weeks
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2010-12-07 15:09:29 UTC (rev 13887)
+++ gnunet/src/dv/gnunet-service-dv.c 2010-12-07 17:18:53 UTC (rev 13888)
@@ -855,7 +855,7 @@
*/
static void
try_core_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct PendingMessage *pending;
pending = core_pending_head;
@@ -863,8 +863,8 @@
if (core_transmit_handle != NULL)
return; /* Message send already in progress */
- if (pending != NULL)
- core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI,
pending->importance, pending->timeout, &pending->recipient, pending->msg_size,
&core_transmit_notify, NULL);
+ if ((pending != NULL) && (coreAPI != NULL))
+ core_transmit_handle = GNUNET_CORE_notify_transmit_ready (coreAPI,
pending->importance, pending->timeout, &pending->recipient, pending->msg_size,
&core_transmit_notify, NULL);
}
/**
@@ -1440,8 +1440,6 @@
pos = pos->next;
}
#endif
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%s: unknown sender (%u), Message uid %u from %s!\n",
my_short_id, ntohl(incoming->sender), ntohl(incoming->uid),
GNUNET_i2s(&dn->identity));
found_pos = -1;
for (i = 0; i< MAX_OUTSTANDING_MESSAGES; i++)
@@ -2148,6 +2146,7 @@
GNUNET_CONTAINER_heap_destroy(neighbor_min_heap);
GNUNET_CORE_disconnect (coreAPI);
+ coreAPI = NULL;
GNUNET_PEERINFO_disconnect(peerinfo_handle);
GNUNET_SERVER_mst_destroy(coreMST);
GNUNET_free_non_null(my_short_id);
@@ -2963,6 +2962,7 @@
struct DistantNeighbor *referee;
struct FindDestinationContext fdc;
struct DisconnectContext disconnect_context;
+ struct PendingMessage *pending_pos;
#if DEBUG_DV
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2971,10 +2971,24 @@
neighbor =
GNUNET_CONTAINER_multihashmap_get (direct_neighbors, &peer->hashPubKey);
+
if (neighbor == NULL)
{
return;
}
+
+ pending_pos = core_pending_head;
+ while (NULL != pending_pos)
+ {
+ if (0 == memcmp(&pending_pos->recipient, &neighbor->identity,
sizeof(struct GNUNET_PeerIdentity)))
+ {
+ GNUNET_CONTAINER_DLL_remove(core_pending_head, core_pending_tail,
pending_pos);
+ pending_pos = core_pending_head;
+ }
+ else
+ pending_pos = pending_pos->next;
+ }
+
while (NULL != (referee = neighbor->referee_head))
distant_neighbor_free (referee);
@@ -2992,11 +3006,12 @@
GNUNET_assert (neighbor->referee_tail == NULL);
if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_remove (direct_neighbors,
- &peer->hashPubKey, neighbor))
+ &peer->hashPubKey,
neighbor))
{
GNUNET_break(0);
}
- if ((neighbor->send_context != NULL) && (neighbor->send_context->task !=
GNUNET_SCHEDULER_NO_TASK))
+ if ((neighbor->send_context != NULL) &&
+ (neighbor->send_context->task != GNUNET_SCHEDULER_NO_TASK))
GNUNET_SCHEDULER_cancel(neighbor->send_context->task);
GNUNET_free (neighbor);
}
@@ -3072,8 +3087,8 @@
/* Scheduled the task to clean up when shutdown is called */
cleanup_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_task,
- NULL);
+ &shutdown_task,
+ NULL);
}
Modified: gnunet/src/dv/test_transport_api_dv.c
===================================================================
--- gnunet/src/dv/test_transport_api_dv.c 2010-12-07 15:09:29 UTC (rev
13887)
+++ gnunet/src/dv/test_transport_api_dv.c 2010-12-07 17:18:53 UTC (rev
13888)
@@ -25,7 +25,7 @@
#include "gnunet_testing_lib.h"
#include "gnunet_core_service.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
#define TEST_ALL GNUNET_NO
@@ -502,66 +502,111 @@
{NULL, 0, 0}
};
+/**
+ * Notify of all peer1's peers, once peer 2 is found, schedule connect
+ * to peer two for message send.
+ *
+ * @param cls closure
+ * @param peer peer identity this notification is about
+ * @param atsi performance data for the connection
+ */
+static void connect_notify_peer2 (void *cls,
+ const struct
+ GNUNET_PeerIdentity *peer,
+ const struct
GNUNET_TRANSPORT_ATS_Information *atsi)
+{
+ struct TestMessageContext *pos = cls;
+
+ if (0 == memcmp(&pos->peer1->id, peer, sizeof(struct GNUNET_PeerIdentity)))
+ {
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Core connection from `%s' to `%4s' verfied, sending
message!\n",
+ GNUNET_i2s(&pos->peer2->id), GNUNET_h2s (&peer->hashPubKey));
+#endif
+ if (NULL == GNUNET_CORE_notify_transmit_ready (pos->peer1handle,
+ 0,
+ TIMEOUT,
+ &pos->peer2->id,
+ sizeof (struct
GNUNET_TestMessage),
+ &transmit_ready, pos))
+ {
+ /* This probably shouldn't happen, but it does (timing issue?) */
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "RECEIVED NULL when asking core (1) for transmission to
peer `%4s'\n",
+ GNUNET_i2s (&pos->peer2->id));
+ transmit_ready_failed++;
+ total_other_expected_messages--;
+ }
+ else
+ {
+ transmit_ready_scheduled++;
+ }
+ }
+}
+
static void
init_notify_peer2 (void *cls,
struct GNUNET_CORE_Handle *server,
const struct GNUNET_PeerIdentity *my_identity,
const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
{
- struct TestMessageContext *pos = cls;
-
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Core connection to `%4s' established, scheduling message
send\n",
+ "Core connection to `%4s' established, awaiting connections.\n",
GNUNET_i2s (my_identity));
#endif
total_server_connections++;
+}
- if (NULL == GNUNET_CORE_notify_transmit_ready (pos->peer1handle,
- 0,
- TIMEOUT,
- &pos->peer2->id,
- sizeof (struct
GNUNET_TestMessage),
- &transmit_ready, pos))
+/**
+ * Notify of all peer1's peers, once peer 2 is found, schedule connect
+ * to peer two for message send.
+ *
+ * @param cls closure
+ * @param peer peer identity this notification is about
+ * @param atsi performance data for the connection
+ */
+static void connect_notify_peer1 (void *cls,
+ const struct
+ GNUNET_PeerIdentity *peer,
+ const struct
GNUNET_TRANSPORT_ATS_Information *atsi)
+{
+ struct TestMessageContext *pos = cls;
+
+ if (0 == memcmp(&pos->peer2->id, peer, sizeof(struct GNUNET_PeerIdentity)))
{
+#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "RECEIVED NULL when asking core (1) for transmission to peer
`%4s'\n",
- GNUNET_i2s (&pos->peer2->id));
- transmit_ready_failed++;
+ "Core connection from `%s' to `%4s' verified.\n",
+ GNUNET_i2s(&pos->peer1->id), GNUNET_h2s (&peer->hashPubKey));
+#endif
+ /*
+ * Connect to the receiving peer
+ */
+ pos->peer2handle = GNUNET_CORE_connect (pos->peer2->cfg,
+ 1,
+ pos,
+ &init_notify_peer2,
+ &connect_notify_peer2,
+ NULL,
+ NULL, NULL,
+ GNUNET_YES, NULL, GNUNET_YES,
handlers);
}
- else
- {
- transmit_ready_scheduled++;
- }
}
-
static void
init_notify_peer1 (void *cls,
struct GNUNET_CORE_Handle *server,
const struct GNUNET_PeerIdentity *my_identity,
const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
{
- struct TestMessageContext *pos = cls;
total_server_connections++;
-
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Core connection to `%4s' established, setting up handles\n",
+ "Core connection to `%4s' established, awaiting
connections...\n",
GNUNET_i2s (my_identity));
#endif
-
- /*
- * Connect to the receiving peer
- */
- pos->peer2handle = GNUNET_CORE_connect (pos->peer2->cfg,
- 1,
- pos,
- &init_notify_peer2,
- NULL,
- NULL,
- NULL, NULL,
- GNUNET_YES, NULL, GNUNET_YES,
handlers);
}
@@ -595,9 +640,10 @@
1,
pos,
&init_notify_peer1,
- NULL, NULL,
+ &connect_notify_peer1,
NULL,
NULL,
+ NULL,
GNUNET_NO, NULL, GNUNET_NO,
no_handlers);
GNUNET_assert(pos->peer1handle != NULL);
@@ -718,9 +764,7 @@
temp_context->uid = total_connections;
temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
test_messages = temp_context;
-
expected_messages++;
-
}
#if VERBOSE
else
@@ -864,7 +908,6 @@
}
#endif
-
if (dotOutFile != NULL)
{
if (distance == 1)
Modified: gnunet/src/dv/test_transport_dv_data.conf
===================================================================
--- gnunet/src/dv/test_transport_dv_data.conf 2010-12-07 15:09:29 UTC (rev
13887)
+++ gnunet/src/dv/test_transport_dv_data.conf 2010-12-07 17:18:53 UTC (rev
13888)
@@ -46,8 +46,8 @@
PORT = 2571
[testing]
-NUM_PEERS = 3
-ADDITIONAL_MESSAGES = 2
+NUM_PEERS = 5
+ADDITIONAL_MESSAGES = 10
DEBUG = NO
WEAKRANDOM = YES
TOPOLOGY = CLIQUE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13888 - gnunet/src/dv,
gnunet <=