aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
commit3d7fefedc9ba60bd8e8448efe8b628446d958536 (patch)
tree61ce41a52cd6e7232cead77818ef265993b2427e /src/transport/transport_api.c
parent4a0398474db197abed243a123fb971fbeeffab4b (diff)
downloadgnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz
gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index f92895c52..f83b6c098 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) 3 (C) 2009-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -744,7 +744,7 @@ transport_notify_ready (void *cls, size_t size, void *buf)
744 if (th->notify_size + sizeof (struct OutboundMessage) > size) 744 if (th->notify_size + sizeof (struct OutboundMessage) > size)
745 break; /* does not fit */ 745 break; /* does not fit */
746 if (GNUNET_BANDWIDTH_tracker_get_delay 746 if (GNUNET_BANDWIDTH_tracker_get_delay
747 (&n->out_tracker, th->notify_size).rel_value > 0) 747 (&n->out_tracker, th->notify_size).rel_value_us > 0)
748 break; /* too early */ 748 break; /* too early */
749 GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap)); 749 GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap));
750 n->hn = NULL; 750 n->hn = NULL;
@@ -801,7 +801,7 @@ schedule_transmission_task (void *cls,
801 GNUNET_assert (NULL != h->client); 801 GNUNET_assert (NULL != h->client);
802 /* destroy all requests that have timed out */ 802 /* destroy all requests that have timed out */
803 while ((NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap))) && 803 while ((NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap))) &&
804 (GNUNET_TIME_absolute_get_remaining (n->th->timeout).rel_value == 0)) 804 (0 == GNUNET_TIME_absolute_get_remaining (n->th->timeout).rel_value_us))
805 { 805 {
806 /* notify client that the request could not be satisfied within 806 /* notify client that the request could not be satisfied within
807 * the given time constraints */ 807 * the given time constraints */
@@ -868,8 +868,8 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h)
868 else 868 else
869 return; /* no work to be done */ 869 return; /* no work to be done */
870 LOG (GNUNET_ERROR_TYPE_DEBUG, 870 LOG (GNUNET_ERROR_TYPE_DEBUG,
871 "Scheduling next transmission to service in %llu ms\n", 871 "Scheduling next transmission to service in %s\n",
872 (unsigned long long) delay.rel_value); 872 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
873 h->quota_task = 873 h->quota_task =
874 GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h); 874 GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h);
875} 875}
@@ -1007,8 +1007,8 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
1007 GNUNET_free (th); 1007 GNUNET_free (th);
1008 } 1008 }
1009 LOG (GNUNET_ERROR_TYPE_DEBUG, 1009 LOG (GNUNET_ERROR_TYPE_DEBUG,
1010 "Scheduling task to reconnect to transport service in %llu ms.\n", 1010 "Scheduling task to reconnect to transport service in %s.\n",
1011 h->reconnect_delay.rel_value); 1011 GNUNET_STRINGS_relative_time_to_string(h->reconnect_delay, GNUNET_YES));
1012 h->reconnect_task = 1012 h->reconnect_task =
1013 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); 1013 GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
1014 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); 1014 h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
@@ -1564,12 +1564,13 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
1564 /* calculate when our transmission should be ready */ 1564 /* calculate when our transmission should be ready */
1565 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead); 1565 delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead);
1566 n->traffic_overhead = 0; 1566 n->traffic_overhead = 0;
1567 if (delay.rel_value > timeout.rel_value) 1567 if (delay.rel_value_us > timeout.rel_value_us)
1568 delay.rel_value = 0; /* notify immediately (with failure) */ 1568 delay.rel_value_us = 0; /* notify immediately (with failure) */
1569 LOG (GNUNET_ERROR_TYPE_DEBUG, 1569 LOG (GNUNET_ERROR_TYPE_DEBUG,
1570 "Bandwidth tracker allows next transmission to peer %s in %llu ms\n", 1570 "Bandwidth tracker allows next transmission to peer %s in %s\n",
1571 GNUNET_i2s (target), (unsigned long long) delay.rel_value); 1571 GNUNET_i2s (target),
1572 n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value); 1572 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
1573 n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value_us);
1573 schedule_transmission (handle); 1574 schedule_transmission (handle);
1574 return th; 1575 return th;
1575} 1576}