aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api_new.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-06-05 12:34:19 +0000
committerChristian Grothoff <christian@grothoff.org>2011-06-05 12:34:19 +0000
commitcc0893746713bda2cfc14e29269d643eb9755a9c (patch)
tree10aa7ce25af71724fc1784b1a4373b0310b3496c /src/transport/transport_api_new.c
parentd8dc57a9aafa0bfa3669e84a5a09a8feeed63e68 (diff)
downloadgnunet-cc0893746713bda2cfc14e29269d643eb9755a9c.tar.gz
gnunet-cc0893746713bda2cfc14e29269d643eb9755a9c.zip
fix
Diffstat (limited to 'src/transport/transport_api_new.c')
-rw-r--r--src/transport/transport_api_new.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/transport/transport_api_new.c b/src/transport/transport_api_new.c
index 86cf7f175..8136e6fb4 100644
--- a/src/transport/transport_api_new.c
+++ b/src/transport/transport_api_new.c
@@ -625,7 +625,6 @@ transport_notify_ready (void *cls, size_t size, void *buf)
625 struct GNUNET_TRANSPORT_TransmitHandle *th; 625 struct GNUNET_TRANSPORT_TransmitHandle *th;
626 struct Neighbour *n; 626 struct Neighbour *n;
627 char *cbuf; 627 char *cbuf;
628 struct GNUNET_TIME_Relative delay;
629 struct OutboundMessage obm; 628 struct OutboundMessage obm;
630 size_t ret; 629 size_t ret;
631 size_t nret; 630 size_t nret;
@@ -663,12 +662,13 @@ transport_notify_ready (void *cls, size_t size, void *buf)
663 662
664 /* then, if possible and no control messages pending, send data messages */ 663 /* then, if possible and no control messages pending, send data messages */
665 while ( (NULL == h->control_head) && 664 while ( (NULL == h->control_head) &&
666 (NULL != (n = GNUNET_CONTAINER_heap_remove_root (h->ready_heap))) ) 665 (NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap))) )
667 { 666 {
668 n->hn = NULL; 667 n->hn = NULL;
669 if (GNUNET_YES != n->is_ready) 668 if (GNUNET_YES != n->is_ready)
670 { 669 {
671 /* peer not ready, wait for notification! */ 670 /* peer not ready, wait for notification! */
671 GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap));
672 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == n->th->timeout_task); 672 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == n->th->timeout_task);
673 n->th->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (n->th->timeout), 673 n->th->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining (n->th->timeout),
674 &timeout_request_due_to_congestion, 674 &timeout_request_due_to_congestion,
@@ -677,15 +677,10 @@ transport_notify_ready (void *cls, size_t size, void *buf)
677 } 677 }
678 th = n->th; 678 th = n->th;
679 if (th->notify_size + sizeof (struct OutboundMessage) > size) 679 if (th->notify_size + sizeof (struct OutboundMessage) > size)
680 { 680 break; /* does not fit */
681 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size); 681 if (GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, th->notify_size).rel_value > 0)
682 if (delay.rel_value > GNUNET_TIME_absolute_get_remaining (n->th->timeout).rel_value) 682 break; /* too early */
683 delay.rel_value = 0; /* notify immediately (with failure) */ 683 GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap));
684 n->hn = GNUNET_CONTAINER_heap_insert (h->ready_heap,
685 n,
686 delay.rel_value);
687 break; /* does not fit */
688 }
689 n->th = NULL; 684 n->th = NULL;
690 n->is_ready = GNUNET_NO; 685 n->is_ready = GNUNET_NO;
691 GNUNET_assert (size >= sizeof (struct OutboundMessage)); 686 GNUNET_assert (size >= sizeof (struct OutboundMessage));