diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-18 22:57:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-18 22:57:37 +0000 |
commit | 647ec74b097c5581664362b4d5a2f7759553370a (patch) | |
tree | 2645877f01ce9f192384229695370c2d02cb2d79 /src/dv | |
parent | 38c6188791c21c815d4260593116698fa6b1bf4d (diff) | |
download | gnunet-647ec74b097c5581664362b4d5a2f7759553370a.tar.gz gnunet-647ec74b097c5581664362b4d5a2f7759553370a.zip |
-fix transmission logic in DV API
Diffstat (limited to 'src/dv')
-rw-r--r-- | src/dv/dv_api.c | 23 | ||||
-rw-r--r-- | 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 | |||
@@ -198,6 +198,15 @@ reconnect (struct GNUNET_DV_ServiceHandle *sh); | |||
198 | 198 | ||
199 | 199 | ||
200 | /** | 200 | /** |
201 | * Start sending messages from our queue to the service. | ||
202 | * | ||
203 | * @param sh service handle | ||
204 | */ | ||
205 | static void | ||
206 | start_transmit (struct GNUNET_DV_ServiceHandle *sh); | ||
207 | |||
208 | |||
209 | /** | ||
201 | * Gives a message from our queue to the DV service. | 210 | * Gives a message from our queue to the DV service. |
202 | * | 211 | * |
203 | * @param cls handle to the dv service (`struct GNUNET_DV_ServiceHandle`) | 212 | * @param cls handle to the dv service (`struct GNUNET_DV_ServiceHandle`) |
@@ -236,15 +245,17 @@ transmit_pending (void *cls, size_t size, void *buf) | |||
236 | ret += tsize; | 245 | ret += tsize; |
237 | if (NULL != th->cb) | 246 | if (NULL != th->cb) |
238 | { | 247 | { |
239 | GNUNET_CONTAINER_DLL_insert (th->target->head, | 248 | GNUNET_CONTAINER_DLL_insert_tail (th->target->head, |
240 | th->target->tail, | 249 | th->target->tail, |
241 | th); | 250 | th); |
242 | } | 251 | } |
243 | else | 252 | else |
244 | { | 253 | { |
245 | GNUNET_free (th); | 254 | GNUNET_free (th); |
246 | } | 255 | } |
247 | } | 256 | } |
257 | if (NULL != sh->th_head) | ||
258 | start_transmit (sh); | ||
248 | return ret; | 259 | return ret; |
249 | } | 260 | } |
250 | 261 | ||
@@ -691,9 +702,9 @@ GNUNET_DV_send (struct GNUNET_DV_ServiceHandle *sh, | |||
691 | /* use memcpy here as 'target' may not be sufficiently aligned */ | 702 | /* use memcpy here as 'target' may not be sufficiently aligned */ |
692 | memcpy (&sm->target, target, sizeof (struct GNUNET_PeerIdentity)); | 703 | memcpy (&sm->target, target, sizeof (struct GNUNET_PeerIdentity)); |
693 | memcpy (&sm[1], msg, ntohs (msg->size)); | 704 | memcpy (&sm[1], msg, ntohs (msg->size)); |
694 | GNUNET_CONTAINER_DLL_insert (sh->th_head, | 705 | GNUNET_CONTAINER_DLL_insert_tail (sh->th_head, |
695 | sh->th_tail, | 706 | sh->th_tail, |
696 | th); | 707 | th); |
697 | start_transmit (sh); | 708 | start_transmit (sh); |
698 | return th; | 709 | return th; |
699 | } | 710 | } |
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, | |||
1961 | if (NULL == route) | 1961 | if (NULL == route) |
1962 | { | 1962 | { |
1963 | /* got disconnected */ | 1963 | /* got disconnected */ |
1964 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1965 | "No route to %s, dropping local message of type %u\n", | ||
1966 | GNUNET_i2s (&msg->target), | ||
1967 | ntohs (payload->type)); | ||
1964 | GNUNET_STATISTICS_update (stats, | 1968 | GNUNET_STATISTICS_update (stats, |
1965 | "# local messages discarded (no route)", | 1969 | "# local messages discarded (no route)", |
1966 | 1, GNUNET_NO); | 1970 | 1, GNUNET_NO); |
@@ -1969,8 +1973,9 @@ handle_dv_send_message (void *cls, struct GNUNET_SERVER_Client *client, | |||
1969 | return; | 1973 | return; |
1970 | } | 1974 | } |
1971 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1975 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1972 | "Forwarding %u bytes to %s\n", | 1976 | "Forwarding %u bytes of type %u to %s\n", |
1973 | ntohs (payload->size), | 1977 | ntohs (payload->size), |
1978 | ntohs (payload->type), | ||
1974 | GNUNET_i2s (&msg->target)); | 1979 | GNUNET_i2s (&msg->target)); |
1975 | 1980 | ||
1976 | forward_payload (route->next_hop, | 1981 | forward_payload (route->next_hop, |