aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/transport_api_core.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c
index f6ea43db9..de18a140c 100644
--- a/src/transport/transport_api_core.c
+++ b/src/transport/transport_api_core.c
@@ -354,6 +354,25 @@ handle_hello (void *cls,
354 * @param cls the `struct Neighbour` where the message was sent 354 * @param cls the `struct Neighbour` where the message was sent
355 */ 355 */
356static void 356static void
357notify_send_done_fin (void *cls)
358{
359 struct Neighbour *n = cls;
360
361 n->timeout_task = NULL;
362 n->is_ready = GNUNET_YES;
363 GNUNET_MQ_impl_send_continue (n->mq);
364}
365
366
367/**
368 * A message from the handler's message queue to a neighbour was
369 * transmitted. Now trigger (possibly delayed) notification of the
370 * neighbour's message queue that we are done and thus ready for
371 * the next message.
372 *
373 * @param cls the `struct Neighbour` where the message was sent
374 */
375static void
357notify_send_done (void *cls) 376notify_send_done (void *cls)
358{ 377{
359 struct Neighbour *n = cls; 378 struct Neighbour *n = cls;
@@ -364,8 +383,8 @@ notify_send_done (void *cls)
364 { 383 {
365 GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker, 384 GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker,
366 n->env_size + n->traffic_overhead); 385 n->env_size + n->traffic_overhead);
367 n->traffic_overhead = 0;
368 n->env = NULL; 386 n->env = NULL;
387 n->traffic_overhead = 0;
369 } 388 }
370 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, 389 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker,
371 128); 390 128);
@@ -375,10 +394,11 @@ notify_send_done (void *cls)
375 GNUNET_MQ_impl_send_continue (n->mq); 394 GNUNET_MQ_impl_send_continue (n->mq);
376 return; 395 return;
377 } 396 }
397 GNUNET_MQ_impl_send_in_flight (n->mq);
378 /* cannot send even a small message without violating 398 /* cannot send even a small message without violating
379 quota, wait a before notifying MQ */ 399 quota, wait a before allowing MQ to send next message */
380 n->timeout_task = GNUNET_SCHEDULER_add_delayed (delay, 400 n->timeout_task = GNUNET_SCHEDULER_add_delayed (delay,
381 &notify_send_done, 401 &notify_send_done_fin,
382 n); 402 n);
383} 403}
384 404
@@ -411,6 +431,7 @@ mq_send_impl (struct GNUNET_MQ_Handle *mq,
411 GNUNET_MQ_impl_send_continue (mq); 431 GNUNET_MQ_impl_send_continue (mq);
412 return; 432 return;
413 } 433 }
434 GNUNET_assert (NULL == n->env);
414 n->env = GNUNET_MQ_msg_nested_mh (obm, 435 n->env = GNUNET_MQ_msg_nested_mh (obm,
415 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 436 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND,
416 msg); 437 msg);