[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31549 - gnunet/src/dv
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31549 - gnunet/src/dv |
Date: |
Wed, 18 Dec 2013 22:05:57 +0100 |
Author: grothoff
Date: 2013-12-18 22:05:57 +0100 (Wed, 18 Dec 2013)
New Revision: 31549
Modified:
gnunet/src/dv/dv_api.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/dv/plugin_transport_dv.c
Log:
-misc fixes
Modified: gnunet/src/dv/dv_api.c
===================================================================
--- gnunet/src/dv/dv_api.c 2013-12-18 20:43:10 UTC (rev 31548)
+++ gnunet/src/dv/dv_api.c 2013-12-18 21:05:57 UTC (rev 31549)
@@ -426,6 +426,14 @@
reconnect (sh);
return;
}
+ if (NULL ==
+ GNUNET_CONTAINER_multipeermap_get (sh->peers,
+ &rm->sender))
+ {
+ GNUNET_break (0);
+ reconnect (sh);
+ return;
+ }
sh->message_cb (sh->cls,
&rm->sender,
ntohl (rm->distance),
@@ -443,7 +451,7 @@
peer = GNUNET_CONTAINER_multipeermap_get (sh->peers,
&ack->target);
if (NULL == peer)
- return; /* this happens, just ignore */
+ break; /* this happens, just ignore */
for (th = peer->head; NULL != th; th = th->next)
{
if (th->uid != ntohl (ack->uid))
@@ -466,6 +474,9 @@
reconnect (sh);
break;
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received message, continuing receive loop for %p\n",
+ sh->client);
GNUNET_CLIENT_receive (sh->client,
&handle_message_receipt, sh,
GNUNET_TIME_UNIT_FOREVER_REL);
@@ -499,6 +510,9 @@
start_message.size = htons (sizeof (struct GNUNET_MessageHeader));
start_message.type = htons (GNUNET_MESSAGE_TYPE_DV_START);
memcpy (buf, &start_message, sizeof (start_message));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitting START request, starting receive loop for %p\n",
+ sh->client);
GNUNET_CLIENT_receive (sh->client,
&handle_message_receipt, sh,
GNUNET_TIME_UNIT_FOREVER_REL);
@@ -520,6 +534,9 @@
GNUNET_CLIENT_notify_transmit_ready_cancel (sh->th);
sh->th = NULL;
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Disconnecting from DV service at %p\n",
+ sh->client);
if (NULL != sh->client)
{
GNUNET_CLIENT_disconnect (sh->client);
@@ -643,10 +660,11 @@
return NULL;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Asked to send %u bytes of type %u to %s\n",
+ "Asked to send %u bytes of type %u to %s via %p\n",
(unsigned int) ntohs (msg->size),
(unsigned int) ntohs (msg->type),
- GNUNET_i2s (target));
+ GNUNET_i2s (target),
+ sh->client);
peer = GNUNET_CONTAINER_multipeermap_get (sh->peers,
target);
if (NULL == peer)
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2013-12-18 20:43:10 UTC (rev 31548)
+++ gnunet/src/dv/gnunet-service-dv.c 2013-12-18 21:05:57 UTC (rev 31549)
@@ -341,7 +341,7 @@
/**
* Hashmap with all routes that we currently support; contains
* routing information for all peers from distance 2
- * up to distance DEFAULT_FISHEYE_DEPTH.
+ * up to distance #DEFAULT_FISHEYE_DEPTH.
*/
static struct GNUNET_CONTAINER_MultiPeerMap *all_routes;
@@ -1974,7 +1974,7 @@
GNUNET_i2s (&msg->target));
forward_payload (route->next_hop,
- ntohl (route->target.distance),
+ 0 /* first hop, distance is zero */,
htonl (msg->uid),
&my_identity,
&msg->target,
Modified: gnunet/src/dv/plugin_transport_dv.c
===================================================================
--- gnunet/src/dv/plugin_transport_dv.c 2013-12-18 20:43:10 UTC (rev 31548)
+++ gnunet/src/dv/plugin_transport_dv.c 2013-12-18 21:05:57 UTC (rev 31549)
@@ -70,7 +70,7 @@
GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
/**
- * Closure for transmit_cont.
+ * Closure for @e transmit_cont.
*/
void *transmit_cont_cls;
@@ -84,6 +84,10 @@
*/
struct Session *session;
+ /**
+ * Number of bytes to transmit.
+ */
+ size_t size;
};
@@ -214,6 +218,12 @@
ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
ats.value = htonl (session->distance);
session->active = GNUNET_YES;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Delivering message of type %u with %u bytes from peer `%s'\n",
+ ntohs (message->type),
+ ntohs (message->size),
+ GNUNET_i2s (&session->sender));
+
plugin->env->receive (plugin->env->cls,
&session->sender,
message,
@@ -245,8 +255,7 @@
struct Session *session;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' message for peer `%s': new distance %u\n",
- "DV_MESSAGE_RECEIVED",
+ "Received DV_MESSAGE_RECEIVED message for peer `%s': new distance %u\n",
GNUNET_i2s (sender), distance);
session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
sender);
@@ -258,6 +267,8 @@
if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type))
{
/* need to unbox using MST */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Unboxing DV message using MST\n");
GNUNET_SERVER_mst_receive (plugin->mst,
session,
(const char *) &msg[1],
@@ -269,6 +280,11 @@
ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
ats.value = htonl (distance);
session->active = GNUNET_YES;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Delivering message of type %u with %u bytes from peer `%s'\n",
+ ntohs (msg->type),
+ ntohs (msg->size),
+ GNUNET_i2s (sender));
plugin->env->receive (plugin->env->cls, sender,
msg,
session, "", 0);
@@ -420,7 +436,8 @@
if (NULL != pr->transmit_cont)
pr->transmit_cont (pr->transmit_cont_cls,
&session->sender,
- GNUNET_SYSERR, 0, 0);
+ GNUNET_SYSERR,
+ pr->size, 0);
GNUNET_free (pr);
}
GNUNET_free (session);
@@ -473,7 +490,8 @@
if (NULL != pr->transmit_cont)
pr->transmit_cont (pr->transmit_cont_cls,
&session->sender,
- ok, 0, 0);
+ ok,
+ pr->size, 0);
GNUNET_free (pr);
}
@@ -516,6 +534,8 @@
if (ntohs (msg->size) != msgbuf_size)
{
/* need to box */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Boxing DV message\n");
box = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader) + msgbuf_size);
box->type = htons (GNUNET_MESSAGE_TYPE_DV_BOX);
box->size = htons (sizeof (struct GNUNET_MessageHeader) + msgbuf_size);
@@ -526,13 +546,14 @@
pr->transmit_cont = cont;
pr->transmit_cont_cls = cont_cls;
pr->session = session;
+ pr->size = msgbuf_size;
GNUNET_CONTAINER_DLL_insert_tail (session->pr_head,
session->pr_tail,
pr);
pr->th = GNUNET_DV_send (plugin->dvh,
&session->sender,
- msg ,
+ msg,
&send_finished,
pr);
GNUNET_free_non_null (box);
@@ -570,7 +591,8 @@
if (NULL != pr->transmit_cont)
pr->transmit_cont (pr->transmit_cont_cls,
&session->sender,
- GNUNET_SYSERR, 0, 0);
+ GNUNET_SYSERR,
+ pr->size, 0);
GNUNET_free (pr);
}
session->active = GNUNET_NO;
@@ -602,7 +624,8 @@
if (NULL != pr->transmit_cont)
pr->transmit_cont (pr->transmit_cont_cls,
&session->sender,
- GNUNET_SYSERR, 0, 0);
+ GNUNET_SYSERR,
+ pr->size, 0);
GNUNET_free (pr);
}
session->active = GNUNET_NO;
@@ -672,7 +695,7 @@
*
* @param cls closure
* @param addr pointer to the address
- * @param addrlen length of addr
+ * @param addrlen length of @a addr
* @return #GNUNET_OK if this is a plausible address for this peer
* and transport, #GNUNET_SYSERR if not
*
@@ -743,14 +766,27 @@
return GNUNET_SYSERR;
}
+
+/**
+ * Function that will be called whenever the transport service wants to
+ * notify the plugin that a session is still active and in use and
+ * therefore the session timeout for this session has to be updated
+ *
+ * @param cls closure (`struct Plugin *`)
+ * @param peer which peer was the session for
+ * @param session which session is being updated
+ */
static void
dv_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
struct Session *session)
{
-
+ /* DV currently doesn't time out like "normal" plugins,
+ so it should be safe to do nothing, right?
+ (or should we add an internal timeout?) */
}
+
/**
* Function to obtain the network type for a session
* FIXME: we should probably look at the network type
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31549 - gnunet/src/dv,
gnunet <=