[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11918 - gnunet/src/dv
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11918 - gnunet/src/dv |
Date: |
Thu, 24 Jun 2010 13:03:11 +0200 |
Author: nevans
Date: 2010-06-24 13:03:11 +0200 (Thu, 24 Jun 2010)
New Revision: 11918
Modified:
gnunet/src/dv/dv.h
gnunet/src/dv/dv_api.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/dv/plugin_transport_dv.c
gnunet/src/dv/test_transport_api_dv.c
gnunet/src/dv/test_transport_dv_data.conf
Log:
misc bugfixes, especially core dumps for dv test case
Modified: gnunet/src/dv/dv.h
===================================================================
--- gnunet/src/dv/dv.h 2010-06-23 16:27:29 UTC (rev 11917)
+++ gnunet/src/dv/dv.h 2010-06-24 11:03:11 UTC (rev 11918)
@@ -31,7 +31,7 @@
#define DEBUG_DV_GOSSIP GNUNET_NO
#define DEBUG_DV_GOSSIP_SEND GNUNET_NO
#define DEBUG_DV_GOSSIP_RECEIPT GNUNET_NO
-#define DEBUG_DV_MESSAGES GNUNET_YES
+#define DEBUG_DV_MESSAGES GNUNET_NO
#define DEBUG_DV GNUNET_NO
#define DEBUG_DV_PEER_NUMBERS GNUNET_NO
#define DEBUG_MESSAGE_DROP GNUNET_NO
@@ -156,11 +156,6 @@
struct GNUNET_PeerIdentity target;
/**
- * The size of the msgbuf
- */
- uint32_t msgbuf_size;
-
- /**
* Message priority
*/
uint32_t priority;
@@ -273,4 +268,11 @@
GNUNET_DV_MessageReceivedHandler receive_handler,
void *receive_handler_cls);
+/**
+ * Disconnect from the DV service
+ *
+ * @param handle the current handle to the service to disconnect
+ */
+void GNUNET_DV_disconnect(struct GNUNET_DV_Handle *handle);
+
#endif
Modified: gnunet/src/dv/dv_api.c
===================================================================
--- gnunet/src/dv/dv_api.c 2010-06-23 16:27:29 UTC (rev 11917)
+++ gnunet/src/dv/dv_api.c 2010-06-24 11:03:11 UTC (rev 11918)
@@ -38,7 +38,9 @@
#include "dv.h"
#include "../transport/plugin_transport.h"
-
+/**
+ * Store ready to send messages
+ */
struct PendingMessages
{
/**
@@ -58,8 +60,6 @@
};
-
-
/**
* Handle for the service.
*/
@@ -96,11 +96,6 @@
struct PendingMessages *current;
/**
- * Kill off the connection and any pending messages.
- */
- int do_destroy;
-
- /**
* Handler for messages we receive from the DV service
*/
GNUNET_DV_MessageReceivedHandler receive_handler;
@@ -171,6 +166,8 @@
/**
* Try to (re)connect to the dv service.
*
+ * @param ret handle to the (disconnected) dv service
+ *
* @return GNUNET_YES on success, GNUNET_NO on failure.
*/
static int
@@ -192,6 +189,9 @@
/**
* Send complete, schedule next
+ *
+ * @param handle handle to the dv service
+ * @param code return code for send (unused)
*/
static void
finish (struct GNUNET_DV_Handle *handle, int code)
@@ -204,7 +204,15 @@
GNUNET_free (pos);
}
-
+/**
+ * Notification that we can send data
+ *
+ * @param cls handle to the dv service (struct GNUNET_DV_Handle)
+ * @param size how many bytes can we send
+ * @buf where to copy the message to send
+ *
+ * @return how many bytes we copied to buf
+ */
static size_t
transmit_pending (void *cls, size_t size, void *buf)
{
@@ -249,6 +257,8 @@
/**
* Try to send messages from list of messages to send
+ *
+ * @param handle handle to the distance vector service
*/
static void process_pending_message(struct GNUNET_DV_Handle *handle)
{
@@ -265,11 +275,6 @@
handle->current = handle->pending_list;
if (NULL == handle->current)
{
- if (handle->do_destroy)
- {
- handle->do_destroy = GNUNET_NO;
- //GNUNET_DV_disconnect (handle); /* FIXME: replace with proper
disconnect stuffs */
- }
return;
}
handle->pending_list = handle->pending_list->next;
@@ -277,10 +282,10 @@
if (NULL ==
(handle->th = GNUNET_CLIENT_notify_transmit_ready (handle->client,
-
ntohl(handle->current->msg->msgbuf_size),
-
handle->current->msg->timeout,
- GNUNET_YES,
- &transmit_pending,
handle)))
+
ntohs(handle->current->msg->header.size),
+
handle->current->msg->timeout,
+ GNUNET_YES,
+ &transmit_pending,
handle)))
{
#if DEBUG_DV
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -456,7 +461,6 @@
msg->header.size = htons(msize);
msg->header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_DV_SEND);
memcpy(&msg->target, target, sizeof(struct GNUNET_PeerIdentity));
- msg->msgbuf_size = htonl(msgbuf_size);
msg->priority = htonl(priority);
msg->timeout = timeout;
msg->addrlen = htonl(addrlen);
@@ -476,9 +480,16 @@
return GNUNET_OK;
}
-/* Forward declaration */
-void GNUNET_DV_disconnect(struct GNUNET_DV_Handle *handle);
-
+/**
+ * Callback to transmit a start message to
+ * the DV service, once we can send
+ *
+ * @param cls struct StartContext
+ * @param size how much can we send
+ * @param buf where to copy the message
+ *
+ * @return number of bytes copied to buf
+ */
static size_t
transmit_start (void *cls, size_t size, void *buf)
{
@@ -531,7 +542,6 @@
handle->sched = sched;
handle->pending_list = NULL;
handle->current = NULL;
- handle->do_destroy = GNUNET_NO;
handle->th = NULL;
handle->client = GNUNET_CLIENT_connect(sched, "dv", cfg);
handle->receive_handler = receive_handler;
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2010-06-23 16:27:29 UTC (rev 11917)
+++ gnunet/src/dv/gnunet-service-dv.c 2010-06-24 11:03:11 UTC (rev 11918)
@@ -503,7 +503,7 @@
/**
* Stream tokenizer to handle messages coming in from core.
*/
-struct GNUNET_SERVER_MessageStreamTokenizer *coreMST;
+static struct GNUNET_SERVER_MessageStreamTokenizer *coreMST;
/**
* The identity of our peer.
@@ -1709,9 +1709,7 @@
address_len = ntohl(send_msg->addrlen);
GNUNET_assert(address_len == sizeof(struct GNUNET_PeerIdentity) * 2);
- message_size = ntohl(send_msg->msgbuf_size);
-
- GNUNET_assert(ntohs(message->size) == sizeof(struct GNUNET_DV_SendMessage) +
address_len + message_size);
+ message_size = ntohs(message->size) - sizeof(struct GNUNET_DV_SendMessage) -
address_len;
destination = GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity));
direct = GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity));
message_buf = GNUNET_malloc(message_size);
Modified: gnunet/src/dv/plugin_transport_dv.c
===================================================================
--- gnunet/src/dv/plugin_transport_dv.c 2010-06-23 16:27:29 UTC (rev 11917)
+++ gnunet/src/dv/plugin_transport_dv.c 2010-06-24 11:03:11 UTC (rev 11918)
@@ -22,30 +22,10 @@
* @file dv/plugin_transport_dv.c
* @brief DV transport service, takes incoming DV requests and deals with
* the DV service
+ * @author Nathan Evans
* @author Christian Grothoff
*/
-/**
- * TODO:
- *
- * As a start, the dv plugin needs to listen for information from the dv
- * service. The plugin (?) will be notified by core (?) when a
tcp/udp/whatever
- * message comes in that should be for dv. The plugin will then hand off the
message
- * to the dv service which will decrypt/validate the message (?) and then send
the
- * result back to us (the transport) which will then send the message to the
transport
- * service (yikes).
- *
- * Or, core will notify the dv service directly which will validate,
- * etc. and then just send a message to us.
- *
- * For starters, this plugin needs to have a client which will listen for
messages from
- * the dv service that need to be sent up to the gnunet-transport-service.
- *
- * Messages sent from the dv transport get passed to the dv service which deals
- * with the actual sending (how much state does this transport need? should it
know
- * which peers it is currently connected to and their distances, or just
assume that
- * anything should be passed along to the dv service?).
- */
#include "platform.h"
#include "gnunet_protocols.h"
#include "gnunet_connection_lib.h"
@@ -434,6 +414,9 @@
struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
struct Plugin *plugin = api->cls;
+ if (plugin->dv_handle != NULL)
+ GNUNET_DV_disconnect(plugin->dv_handle);
+
GNUNET_free (plugin);
GNUNET_free (api);
return NULL;
Modified: gnunet/src/dv/test_transport_api_dv.c
===================================================================
--- gnunet/src/dv/test_transport_api_dv.c 2010-06-23 16:27:29 UTC (rev
11917)
+++ gnunet/src/dv/test_transport_api_dv.c 2010-06-24 11:03:11 UTC (rev
11918)
@@ -321,7 +321,15 @@
if ((total_messages_received == expected_messages) && (total_other_messages
== 0))
{
GNUNET_SCHEDULER_cancel (sched, die_task);
- GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 420), &send_other_messages, NULL);
+ /*
+ if ((num_peers == 3) && (total_other_expected_messages == 2))
+ {
+ GNUNET_SCHEDULER_add_now (sched, &send_other_messages, NULL);
+ }
+ else
+ {
+ GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 20), &send_other_messages, NULL);
+ }*/
}
else if ((total_other_expected_messages > 0) && (total_other_messages ==
total_other_expected_messages))
{
@@ -827,6 +835,12 @@
fprintf(dotOutFile, "\tn%s -- n%s [color=brown];\n", d->shortname,
second_shortname);
}
GNUNET_free(second_shortname);
+
+ if ((num_peers == 3) && (temp_total_other_messages == 2))
+ {
+ /*GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 30), &send_other_messages, NULL);*/
+ GNUNET_SCHEDULER_add_now (sched, &send_other_messages, NULL);
+ }
}
static void
@@ -1064,7 +1078,6 @@
#endif
NULL);
ret = check ();
-
/**
* Need to remove base directory, subdirectories taken care
* of by the testing framework.
Modified: gnunet/src/dv/test_transport_dv_data.conf
===================================================================
--- gnunet/src/dv/test_transport_dv_data.conf 2010-06-23 16:27:29 UTC (rev
11917)
+++ gnunet/src/dv/test_transport_dv_data.conf 2010-06-24 11:03:11 UTC (rev
11918)
@@ -10,14 +10,16 @@
PORT = 2565
PLUGINS = tcp dv
BLACKLIST_FILE = $SERVICEHOME/blacklist
-#PREFIX = xterm -e xterm -T transport -e gdb --args
-#BINARY =
/home/mrwiggles/documents/research/gnunet/gnunet-ng/src/transport/.libs/gnunet-service-transport
-#PREFIX = valgrind --tool=memcheck --log-file=logs%p
+#PREFIX = xterm -hold -T transport -e gdb --args
+#PREFIX = gdb --args
+BINARY =
/home/mrwiggles/documents/research/gnunet/gnunet-ng/src/transport/.libs/gnunet-service-transport
+#BINARY = gnunet-service-transport
+PREFIX = valgrind --tool=memcheck --log-file=logs%p --track-origins=yes
#DEBUG = YES
[arm]
PORT = 2566
-DEFAULTSERVICES =
+DEFAULTSERVICES = transport
[statistics]
PORT = 2567
@@ -43,7 +45,7 @@
[dv]
AUTOSTART = YES
-DEBUG = YES
+DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
BINARY = gnunet-service-dv
@@ -58,7 +60,7 @@
[testing]
NUM_PEERS = 3
-DEBUG = YES
+DEBUG = NO
WEAKRANDOM = YES
TOPOLOGY = CLIQUE
CONNECT_TOPOLOGY = LINE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11918 - gnunet/src/dv,
gnunet <=