From 647ec74b097c5581664362b4d5a2f7759553370a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Dec 2013 22:57:37 +0000 Subject: [PATCH] -fix transmission logic in DV API --- src/dv/dv_api.c | 23 +++++++++++++++++------ src/dv/gnunet-service-dv.c | 7 ++++++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c index faf61df5e..bf8151b48 100644 --- a/src/dv/dv_api.c +++ b/src/dv/dv_api.c @@ -197,6 +197,15 @@ static void reconnect (struct GNUNET_DV_ServiceHandle *sh); +/** + * Start sending messages from our queue to the service. + * + * @param sh service handle + */ +static void +start_transmit (struct GNUNET_DV_ServiceHandle *sh); + + /** * Gives a message from our queue to the DV service. * @@ -236,15 +245,17 @@ transmit_pending (void *cls, size_t size, void *buf) ret += tsize; if (NULL != th->cb) { - GNUNET_CONTAINER_DLL_insert (th->target->head, - th->target->tail, - th); + GNUNET_CONTAINER_DLL_insert_tail (th->target->head, + th->target->tail, + th); } else { GNUNET_free (th); } } + if (NULL != sh->th_head) + start_transmit (sh); return ret; } @@ -691,9 +702,9 @@ GNUNET_DV_send (struct GNUNET_DV_ServiceHandle *sh, /* use memcpy here as 'target' may not be sufficiently aligned */ memcpy (&sm->target, target, sizeof (struct GNUNET_PeerIdentity)); memcpy (&sm[1], msg, ntohs (msg->size)); - GNUNET_CONTAINER_DLL_insert (sh->th_head, - sh->th_tail, - th); + GNUNET_CONTAINER_DLL_insert_tail (sh->th_head, + sh->th_tail, + th); start_transmit (sh); return th; } diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 43292e3aa..9132d2a34 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -1961,6 +1961,10 @@ handle_dv_send_message (void *cls, struct GNUNET_SERVER_Client *client, if (NULL == route) { /* got disconnected */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "No route to %s, dropping local message of type %u\n", + GNUNET_i2s (&msg->target), + ntohs (payload->type)); GNUNET_STATISTICS_update (stats, "# local messages discarded (no route)", 1, GNUNET_NO); @@ -1969,8 +1973,9 @@ handle_dv_send_message (void *cls, struct GNUNET_SERVER_Client *client, return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Forwarding %u bytes to %s\n", + "Forwarding %u bytes of type %u to %s\n", ntohs (payload->size), + ntohs (payload->type), GNUNET_i2s (&msg->target)); forward_payload (route->next_hop, -- 2.25.1