aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport.c5
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c35
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c62
-rw-r--r--src/transport/gnunet-service-transport_validation.c58
-rw-r--r--src/transport/gnunet-transport.c4
-rw-r--r--src/transport/plugin_transport_bluetooth.c4
-rw-r--r--src/transport/plugin_transport_http.c18
-rw-r--r--src/transport/plugin_transport_http_client.c43
-rw-r--r--src/transport/plugin_transport_http_server.c112
-rw-r--r--src/transport/plugin_transport_tcp.c30
-rw-r--r--src/transport/plugin_transport_udp.c60
-rw-r--r--src/transport/plugin_transport_unix.c2
-rw-r--r--src/transport/plugin_transport_wlan.c4
-rw-r--r--src/transport/test_quota_compliance.c6
-rw-r--r--src/transport/test_transport_api_manipulation_cfg.c46
-rw-r--r--src/transport/test_transport_api_manipulation_recv_tcp.c23
-rw-r--r--src/transport/test_transport_api_manipulation_send_tcp.c23
-rw-r--r--src/transport/test_transport_api_reliability.c6
-rw-r--r--src/transport/test_transport_api_timeout.c15
-rw-r--r--src/transport/test_transport_api_unreliability.c6
-rw-r--r--src/transport/test_transport_api_unreliability_constant.c7
-rw-r--r--src/transport/transport_api.c25
22 files changed, 336 insertions, 258 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index f9585e512..2d939af36 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -286,8 +286,9 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
286 } 286 }
287end: 287end:
288 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 288 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
289 "Allowing receive from peer %s to continue in %llu ms\n", 289 "Allowing receive from peer %s to continue in %s\n",
290 GNUNET_i2s (peer), (unsigned long long) ret.rel_value); 290 GNUNET_i2s (peer),
291 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES));
291 return ret; 292 return ret;
292} 293}
293 294
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 4a9414622..0ca732d62 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -419,7 +419,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg
419 if (UINT32_MAX != find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND)) 419 if (UINT32_MAX != find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND))
420 { 420 {
421 /* We have a delay */ 421 /* We have a delay */
422 delay.rel_value = find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND); 422 delay.rel_value_us = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND);
423 dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size); 423 dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size);
424 dqe->id = *target; 424 dqe->id = *target;
425 dqe->tmp = tmp; 425 dqe->tmp = tmp;
@@ -434,8 +434,9 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg
434 if (GNUNET_SCHEDULER_NO_TASK == tmp->send_delay_task) 434 if (GNUNET_SCHEDULER_NO_TASK == tmp->send_delay_task)
435 tmp->send_delay_task =GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe); 435 tmp->send_delay_task =GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe);
436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
437 "Delaying %u byte message to peer `%s' with generic delay for %llu ms\n", 437 "Delaying %u byte message to peer `%s' with generic delay for %ms\n",
438 msg_size, GNUNET_i2s (target), (long long unsigned int) delay.rel_value); 438 msg_size, GNUNET_i2s (target),
439 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
439 return; 440 return;
440 } 441 }
441 } 442 }
@@ -443,7 +444,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg
443 { 444 {
444 GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target)); 445 GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target));
445 /* We have a delay */ 446 /* We have a delay */
446 delay.rel_value = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND); 447 delay.rel_value_us = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND);
447 dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size); 448 dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size);
448 dqe->id = *target; 449 dqe->id = *target;
449 dqe->tmp = NULL; 450 dqe->tmp = NULL;
@@ -460,8 +461,9 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg
460 generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe); 461 generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe);
461 } 462 }
462 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 463 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
463 "Delaying %u byte message to peer `%s' with peer specific delay for %llu ms\n", 464 "Delaying %u byte message to peer `%s' with peer specific delay for %s\n",
464 msg_size, GNUNET_i2s (target), (long long unsigned int) delay.rel_value); 465 msg_size, GNUNET_i2s (target),
466 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
465 return; 467 return;
466 } 468 }
467 469
@@ -540,28 +542,29 @@ GST_manipulation_recv (void *cls,
540 struct GNUNET_TIME_Relative m_delay; 542 struct GNUNET_TIME_Relative m_delay;
541 543
542 g_recv_delay = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); 544 g_recv_delay = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE);
543 if ((g_recv_delay >= GNUNET_TIME_UNIT_ZERO.rel_value) && (UINT32_MAX != g_recv_delay)) 545 if ((g_recv_delay >= GNUNET_TIME_UNIT_ZERO.rel_value_us) && (UINT32_MAX != g_recv_delay))
544 m_delay.rel_value = g_recv_delay; /* Global delay */ 546 m_delay.rel_value_us = g_recv_delay; /* Global delay */
545 else 547 else
546 m_delay = GNUNET_TIME_UNIT_ZERO; 548 m_delay = GNUNET_TIME_UNIT_ZERO;
547 549
548 if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) 550 if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey)))
549 { 551 {
550 /* Manipulate receive delay */ 552 /* Manipulate receive delay */
551 p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); 553 p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE);
552 if (UINT32_MAX != p_recv_delay) 554 if (UINT32_MAX != p_recv_delay)
553 m_delay.rel_value = p_recv_delay; /* Peer specific delay */ 555 m_delay.rel_value_us = p_recv_delay; /* Peer specific delay */
554 } 556 }
555 557
556 quota_delay = GST_receive_callback (cls, peer, message, 558 quota_delay = GST_receive_callback (cls, peer, message,
557 session, sender_address, sender_address_len); 559 session, sender_address, sender_address_len);
558 560
559 if (quota_delay.rel_value > m_delay.rel_value) 561 if (quota_delay.rel_value_us > m_delay.rel_value_us)
560 m_delay = quota_delay; 562 m_delay = quota_delay;
561 563
562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 564 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
563 "Delaying next receive for peer `%s' for %llu ms\n", 565 "Delaying next receive for peer `%s' for %s\n",
564 GNUNET_i2s (peer), (long long unsigned int) m_delay.rel_value); 566 GNUNET_i2s (peer),
567 GNUNET_STRINGS_relative_time_to_string (m_delay, GNUNET_YES));
565 return m_delay; 568 return m_delay;
566 569
567} 570}
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 8f53b93be..f09641506 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2010,2011,2012 Christian Grothoff (and other contributing authors) 3 (C) 2010-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
@@ -155,7 +155,7 @@ print_allocators ()
155 next = GNUNET_TIME_UNIT_ZERO_ABS; 155 next = GNUNET_TIME_UNIT_ZERO_ABS;
156 start = GNUNET_NO; 156 start = GNUNET_NO;
157 } 157 }
158 if (0 == (rem = GNUNET_TIME_absolute_get_remaining(next)).rel_value) 158 if (0 == (rem = GNUNET_TIME_absolute_get_remaining(next)).rel_value_us)
159 { 159 {
160 fprintf (stderr, "Allocated in `%s' total: %5u bytes\n", __FILE__, bytes_alloced); 160 fprintf (stderr, "Allocated in `%s' total: %5u bytes\n", __FILE__, bytes_alloced);
161 while (NULL != cur) 161 while (NULL != cur)
@@ -1406,7 +1406,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
1406 while (NULL != (mq = n->messages_head)) 1406 while (NULL != (mq = n->messages_head))
1407 { 1407 {
1408 timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); 1408 timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout);
1409 if (timeout.rel_value > 0) 1409 if (timeout.rel_value_us > 0)
1410 break; 1410 break;
1411 GNUNET_STATISTICS_update (GST_stats, 1411 GNUNET_STATISTICS_update (GST_stats,
1412 gettext_noop 1412 gettext_noop
@@ -1443,7 +1443,7 @@ send_keepalive (struct NeighbourMapEntry *n)
1443 GNUNET_assert ((S_CONNECTED == n->state) || 1443 GNUNET_assert ((S_CONNECTED == n->state) ||
1444 (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || 1444 (S_CONNECTED_SWITCHING_BLACKLIST == n->state) ||
1445 (S_CONNECTED_SWITCHING_CONNECT_SENT)); 1445 (S_CONNECTED_SWITCHING_CONNECT_SENT));
1446 if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value > 0) 1446 if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value_us > 0)
1447 return; /* no keepalive needed at this time */ 1447 return; /* no keepalive needed at this time */
1448 m.size = htons (sizeof (struct GNUNET_MessageHeader)); 1448 m.size = htons (sizeof (struct GNUNET_MessageHeader));
1449 m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE); 1449 m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE);
@@ -1534,14 +1534,16 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour)
1534 n->latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time); 1534 n->latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time);
1535 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 1535 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
1536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1537 "Latency for peer `%s' is %llu ms\n", 1537 "Latency for peer `%s' is %s\n",
1538 GNUNET_i2s (&n->id), n->latency.rel_value); 1538 GNUNET_i2s (&n->id),
1539 GNUNET_STRINGS_relative_time_to_string (n->latency,
1540 GNUNET_YES));
1539 /* append latency */ 1541 /* append latency */
1540 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 1542 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
1541 if (n->latency.rel_value > UINT32_MAX) 1543 if (n->latency.rel_value_us > UINT32_MAX)
1542 latency = UINT32_MAX; 1544 latency = UINT32_MAX;
1543 else 1545 else
1544 latency = n->latency.rel_value; 1546 latency = n->latency.rel_value_us;
1545 ats.value = htonl (latency); 1547 ats.value = htonl (latency);
1546 GST_ats_update_metrics (&n->id, 1548 GST_ats_update_metrics (&n->id,
1547 n->primary_address.address, 1549 n->primary_address.address,
@@ -1622,17 +1624,18 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity
1622 } 1624 }
1623 *do_forward = GNUNET_YES; 1625 *do_forward = GNUNET_YES;
1624 ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 32 * 1024); 1626 ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 32 * 1024);
1625 if (ret.rel_value > 0) 1627 if (ret.rel_value_us > 0)
1626 { 1628 {
1627 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1629 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1628 "Throttling read (%llu bytes excess at %u b/s), waiting %llu ms before reading more.\n", 1630 "Throttling read (%llu bytes excess at %u b/s), waiting %s before reading more.\n",
1629 (unsigned long long) n->in_tracker. 1631 (unsigned long long) n->in_tracker.
1630 consumption_since_last_update__, 1632 consumption_since_last_update__,
1631 (unsigned int) n->in_tracker.available_bytes_per_s__, 1633 (unsigned int) n->in_tracker.available_bytes_per_s__,
1632 (unsigned long long) ret.rel_value); 1634 GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES));
1633 GNUNET_STATISTICS_update (GST_stats, 1635 GNUNET_STATISTICS_update (GST_stats,
1634 gettext_noop ("# ms throttling suggested"), 1636 gettext_noop ("# ms throttling suggested"),
1635 (int64_t) ret.rel_value, GNUNET_NO); 1637 (int64_t) ret.rel_value_us / 1000LL,
1638 GNUNET_NO);
1636 } 1639 }
1637 return ret; 1640 return ret;
1638} 1641}
@@ -2526,10 +2529,11 @@ master_task (void *cls,
2526 n->task = GNUNET_SCHEDULER_NO_TASK; 2529 n->task = GNUNET_SCHEDULER_NO_TASK;
2527 delay = GNUNET_TIME_absolute_get_remaining (n->timeout); 2530 delay = GNUNET_TIME_absolute_get_remaining (n->timeout);
2528 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2531 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2529 "Master task runs for neighbour `%s' in state %s with timeout in %llu ms\n", 2532 "Master task runs for neighbour `%s' in state %s with timeout in %s\n",
2530 GNUNET_i2s (&n->id), 2533 GNUNET_i2s (&n->id),
2531 print_state(n->state), 2534 print_state(n->state),
2532 (unsigned long long) delay.rel_value); 2535 GNUNET_STRINGS_relative_time_to_string (delay,
2536 GNUNET_YES));
2533 switch (n->state) 2537 switch (n->state)
2534 { 2538 {
2535 case S_NOT_CONNECTED: 2539 case S_NOT_CONNECTED:
@@ -2539,7 +2543,7 @@ master_task (void *cls,
2539 free_neighbour (n, GNUNET_NO); 2543 free_neighbour (n, GNUNET_NO);
2540 return; 2544 return;
2541 case S_INIT_ATS: 2545 case S_INIT_ATS:
2542 if (0 == delay.rel_value) 2546 if (0 == delay.rel_value_us)
2543 { 2547 {
2544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2545 "Connection to `%s' timed out waiting for ATS to provide address\n", 2549 "Connection to `%s' timed out waiting for ATS to provide address\n",
@@ -2550,7 +2554,7 @@ master_task (void *cls,
2550 } 2554 }
2551 break; 2555 break;
2552 case S_INIT_BLACKLIST: 2556 case S_INIT_BLACKLIST:
2553 if (0 == delay.rel_value) 2557 if (0 == delay.rel_value_us)
2554 { 2558 {
2555 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2559 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2556 "Connection to `%s' timed out waiting for BLACKLIST to approve address\n", 2560 "Connection to `%s' timed out waiting for BLACKLIST to approve address\n",
@@ -2561,7 +2565,7 @@ master_task (void *cls,
2561 } 2565 }
2562 break; 2566 break;
2563 case S_CONNECT_SENT: 2567 case S_CONNECT_SENT:
2564 if (0 == delay.rel_value) 2568 if (0 == delay.rel_value_us)
2565 { 2569 {
2566 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2570 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2567 "Connection to `%s' timed out waiting for other peer to send CONNECT_ACK\n", 2571 "Connection to `%s' timed out waiting for other peer to send CONNECT_ACK\n",
@@ -2571,7 +2575,7 @@ master_task (void *cls,
2571 } 2575 }
2572 break; 2576 break;
2573 case S_CONNECT_RECV_BLACKLIST_INBOUND: 2577 case S_CONNECT_RECV_BLACKLIST_INBOUND:
2574 if (0 == delay.rel_value) 2578 if (0 == delay.rel_value_us)
2575 { 2579 {
2576 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2580 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2577 "Connection to `%s' timed out waiting BLACKLIST to approve address to use for received CONNECT\n", 2581 "Connection to `%s' timed out waiting BLACKLIST to approve address to use for received CONNECT\n",
@@ -2582,7 +2586,7 @@ master_task (void *cls,
2582 } 2586 }
2583 break; 2587 break;
2584 case S_CONNECT_RECV_ATS: 2588 case S_CONNECT_RECV_ATS:
2585 if (0 == delay.rel_value) 2589 if (0 == delay.rel_value_us)
2586 { 2590 {
2587 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2588 "Connection to `%s' timed out waiting ATS to provide address to use for CONNECT_ACK\n", 2592 "Connection to `%s' timed out waiting ATS to provide address to use for CONNECT_ACK\n",
@@ -2593,7 +2597,7 @@ master_task (void *cls,
2593 } 2597 }
2594 break; 2598 break;
2595 case S_CONNECT_RECV_BLACKLIST: 2599 case S_CONNECT_RECV_BLACKLIST:
2596 if (0 == delay.rel_value) 2600 if (0 == delay.rel_value_us)
2597 { 2601 {
2598 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2602 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2599 "Connection to `%s' timed out waiting BLACKLIST to approve address to use for CONNECT_ACK\n", 2603 "Connection to `%s' timed out waiting BLACKLIST to approve address to use for CONNECT_ACK\n",
@@ -2604,7 +2608,7 @@ master_task (void *cls,
2604 } 2608 }
2605 break; 2609 break;
2606 case S_CONNECT_RECV_ACK: 2610 case S_CONNECT_RECV_ACK:
2607 if (0 == delay.rel_value) 2611 if (0 == delay.rel_value_us)
2608 { 2612 {
2609 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2613 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2610 "Connection to `%s' timed out waiting for other peer to send SESSION_ACK\n", 2614 "Connection to `%s' timed out waiting for other peer to send SESSION_ACK\n",
@@ -2614,7 +2618,7 @@ master_task (void *cls,
2614 } 2618 }
2615 break; 2619 break;
2616 case S_CONNECTED: 2620 case S_CONNECTED:
2617 if (0 == delay.rel_value) 2621 if (0 == delay.rel_value_us)
2618 { 2622 {
2619 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2623 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2620 "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n", 2624 "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n",
@@ -2626,7 +2630,7 @@ master_task (void *cls,
2626 send_keepalive (n); 2630 send_keepalive (n);
2627 break; 2631 break;
2628 case S_RECONNECT_ATS: 2632 case S_RECONNECT_ATS:
2629 if (0 == delay.rel_value) 2633 if (0 == delay.rel_value_us)
2630 { 2634 {
2631 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2635 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2632 "Connection to `%s' timed out, waiting for ATS replacement address\n", 2636 "Connection to `%s' timed out, waiting for ATS replacement address\n",
@@ -2636,7 +2640,7 @@ master_task (void *cls,
2636 } 2640 }
2637 break; 2641 break;
2638 case S_RECONNECT_BLACKLIST: 2642 case S_RECONNECT_BLACKLIST:
2639 if (0 == delay.rel_value) 2643 if (0 == delay.rel_value_us)
2640 { 2644 {
2641 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2645 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2642 "Connection to `%s' timed out, waiting for BLACKLIST to approve replacement address\n", 2646 "Connection to `%s' timed out, waiting for BLACKLIST to approve replacement address\n",
@@ -2646,7 +2650,7 @@ master_task (void *cls,
2646 } 2650 }
2647 break; 2651 break;
2648 case S_RECONNECT_SENT: 2652 case S_RECONNECT_SENT:
2649 if (0 == delay.rel_value) 2653 if (0 == delay.rel_value_us)
2650 { 2654 {
2651 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2655 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2652 "Connection to `%s' timed out, waiting for other peer to CONNECT_ACK replacement address\n", 2656 "Connection to `%s' timed out, waiting for other peer to CONNECT_ACK replacement address\n",
@@ -2656,7 +2660,7 @@ master_task (void *cls,
2656 } 2660 }
2657 break; 2661 break;
2658 case S_CONNECTED_SWITCHING_BLACKLIST: 2662 case S_CONNECTED_SWITCHING_BLACKLIST:
2659 if (0 == delay.rel_value) 2663 if (0 == delay.rel_value_us)
2660 { 2664 {
2661 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2665 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2662 "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n", 2666 "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n",
@@ -2668,7 +2672,7 @@ master_task (void *cls,
2668 send_keepalive (n); 2672 send_keepalive (n);
2669 break; 2673 break;
2670 case S_CONNECTED_SWITCHING_CONNECT_SENT: 2674 case S_CONNECTED_SWITCHING_CONNECT_SENT:
2671 if (0 == delay.rel_value) 2675 if (0 == delay.rel_value_us)
2672 { 2676 {
2673 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2677 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2674 "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs (after trying to CONNECT on alternative address)\n", 2678 "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs (after trying to CONNECT on alternative address)\n",
@@ -2785,7 +2789,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2785 1, GNUNET_NO); 2789 1, GNUNET_NO);
2786 break; 2790 break;
2787 case S_CONNECT_SENT: 2791 case S_CONNECT_SENT:
2788 if (ts.abs_value != n->primary_address.connect_timestamp.abs_value) 2792 if (ts.abs_value_us != n->primary_address.connect_timestamp.abs_value_us)
2789 break; /* ACK does not match our original CONNECT message */ 2793 break; /* ACK does not match our original CONNECT message */
2790 n->state = S_CONNECTED; 2794 n->state = S_CONNECTED;
2791 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 2795 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
@@ -3142,7 +3146,7 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity
3142 sdm = (const struct SessionDisconnectMessage *) msg; 3146 sdm = (const struct SessionDisconnectMessage *) msg;
3143 if (NULL == (n = lookup_neighbour (peer))) 3147 if (NULL == (n = lookup_neighbour (peer)))
3144 return; /* gone already */ 3148 return; /* gone already */
3145 if (GNUNET_TIME_absolute_ntoh (sdm->timestamp).abs_value <= n->connect_ack_timestamp.abs_value) 3149 if (GNUNET_TIME_absolute_ntoh (sdm->timestamp).abs_value_us <= n->connect_ack_timestamp.abs_value_us)
3146 { 3150 {
3147 GNUNET_STATISTICS_update (GST_stats, 3151 GNUNET_STATISTICS_update (GST_stats,
3148 gettext_noop 3152 gettext_noop
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 0c70ee9bb..95a7eb04a 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2010,2011 Christian Grothoff (and other contributing authors) 3 (C) 2010-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
@@ -444,7 +444,7 @@ timeout_hello_validation (void *cls,
444 ve->timeout_task = GNUNET_SCHEDULER_NO_TASK; 444 ve->timeout_task = GNUNET_SCHEDULER_NO_TASK;
445 max = GNUNET_TIME_absolute_max (ve->valid_until, ve->revalidation_block); 445 max = GNUNET_TIME_absolute_max (ve->valid_until, ve->revalidation_block);
446 left = GNUNET_TIME_absolute_get_remaining (max); 446 left = GNUNET_TIME_absolute_get_remaining (max);
447 if (left.rel_value > 0) 447 if (left.rel_value_us > 0)
448 { 448 {
449 /* should wait a bit longer */ 449 /* should wait a bit longer */
450 ve->timeout_task = 450 ve->timeout_task =
@@ -494,7 +494,7 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid,
494 GNUNET_i2s (pid), GST_plugins_a2s (ve->address), ve->address->transport_name); 494 GNUNET_i2s (pid), GST_plugins_a2s (ve->address), ve->address->transport_name);
495 495
496 next = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), validation_delay); 496 next = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), validation_delay);
497 if (next.abs_value > validation_next.abs_value) 497 if (next.abs_value_us > validation_next.abs_value_us)
498 validation_next = next; /* We're going to send a PING so delay next validation */ 498 validation_next = next; /* We're going to send a PING so delay next validation */
499 499
500 slen = strlen (ve->address->transport_name) + 1; 500 slen = strlen (ve->address->transport_name) + 1;
@@ -607,15 +607,15 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
607 canonical_delay = 607 canonical_delay =
608 (ve->in_use == 608 (ve->in_use ==
609 GNUNET_YES) ? CONNECTED_PING_FREQUENCY 609 GNUNET_YES) ? CONNECTED_PING_FREQUENCY
610 : ((GNUNET_TIME_absolute_get_remaining (ve->valid_until).rel_value > 610 : ((GNUNET_TIME_absolute_get_remaining (ve->valid_until).rel_value_us >
611 0) ? VALIDATED_PING_FREQUENCY : UNVALIDATED_PING_KEEPALIVE); 611 0) ? VALIDATED_PING_FREQUENCY : UNVALIDATED_PING_KEEPALIVE);
612 if (delay.rel_value > canonical_delay.rel_value * 2) 612 if (delay.rel_value_us > canonical_delay.rel_value_us * 2)
613 { 613 {
614 /* situation changed, recalculate delay */ 614 /* situation changed, recalculate delay */
615 delay = canonical_delay; 615 delay = canonical_delay;
616 ve->revalidation_block = GNUNET_TIME_relative_to_absolute (delay); 616 ve->revalidation_block = GNUNET_TIME_relative_to_absolute (delay);
617 } 617 }
618 if (delay.rel_value > 0) 618 if (delay.rel_value_us > 0)
619 { 619 {
620 /* should wait a bit longer */ 620 /* should wait a bit longer */
621 ve->revalidation_task = 621 ve->revalidation_task =
@@ -624,7 +624,7 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
624 } 624 }
625 blocked_for = GNUNET_TIME_absolute_get_remaining(validation_next); 625 blocked_for = GNUNET_TIME_absolute_get_remaining(validation_next);
626 if ((validations_running > validations_fast_start_threshold) && 626 if ((validations_running > validations_fast_start_threshold) &&
627 (blocked_for.rel_value > 0)) 627 (blocked_for.rel_value_us > 0))
628 { 628 {
629 /* Validations are blocked, have to wait for blocked_for time */ 629 /* Validations are blocked, have to wait for blocked_for time */
630 ve->revalidation_task = 630 ve->revalidation_task =
@@ -636,24 +636,20 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
636 /* schedule next PINGing with some extra random delay to avoid synchronous re-validations */ 636 /* schedule next PINGing with some extra random delay to avoid synchronous re-validations */
637 rdelay = 637 rdelay =
638 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 638 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
639 canonical_delay.rel_value); 639 canonical_delay.rel_value_us);
640 640
641 /* Debug code for mantis 0002726*/ 641 /* Debug code for mantis 0002726 */
642 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == 642 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us ==
643 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, rdelay).rel_value) 643 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, rdelay).rel_value_us)
644 { 644 {
645 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 645 GNUNET_break (0);
646 "Revalidation interval for peer `%s' for is FOREVER (debug: rdelay: %llu, canonical delay %llu)\n",
647 GNUNET_i2s (&ve->pid),
648 (unsigned long long) delay.rel_value,
649 (unsigned long long) canonical_delay.rel_value);
650 delay = canonical_delay; 646 delay = canonical_delay;
651 } 647 }
652 else 648 else
653 { 649 {
654 delay = GNUNET_TIME_relative_add (canonical_delay, 650 delay = GNUNET_TIME_relative_add (canonical_delay,
655 GNUNET_TIME_relative_multiply 651 GNUNET_TIME_relative_multiply
656 (GNUNET_TIME_UNIT_MILLISECONDS, rdelay)); 652 (GNUNET_TIME_UNIT_MICROSECONDS, rdelay));
657 } 653 }
658 /* End debug code for mantis 0002726*/ 654 /* End debug code for mantis 0002726*/
659 ve->revalidation_task = 655 ve->revalidation_task =
@@ -739,7 +735,7 @@ add_valid_address (void *cls, const struct GNUNET_HELLO_Address *address,
739 struct GNUNET_ATS_Information ats; 735 struct GNUNET_ATS_Information ats;
740 struct GNUNET_CRYPTO_EccPublicKey public_key; 736 struct GNUNET_CRYPTO_EccPublicKey public_key;
741 737
742 if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) 738 if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
743 return GNUNET_OK; /* expired */ 739 return GNUNET_OK; /* expired */
744 if ((GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid)) || 740 if ((GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid)) ||
745 (GNUNET_OK != GNUNET_HELLO_get_key (hello, &public_key))) 741 (GNUNET_OK != GNUNET_HELLO_get_key (hello, &public_key)))
@@ -806,16 +802,18 @@ GST_validation_start (unsigned int max_fds)
806 * when doing to many validations in parallel: 802 * when doing to many validations in parallel:
807 * if (running validations < (max_fds / 2)) 803 * if (running validations < (max_fds / 2))
808 * - "fast start": run validation immediately 804 * - "fast start": run validation immediately
809 * - have delay of (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value) / (max_fds / 2) 805 * - have delay of (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us) / (max_fds / 2)
810 * (300 sec / ~150 == ~2 sec.) between two validations 806 * (300 sec / ~150 == ~2 sec.) between two validations
811 */ 807 */
812 808
813 validation_next = GNUNET_TIME_absolute_get(); 809 validation_next = GNUNET_TIME_absolute_get();
814 validation_delay.rel_value = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value) / (max_fds / 2); 810 validation_delay.rel_value_us = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us) / (max_fds / 2);
815 validations_fast_start_threshold = (max_fds / 2); 811 validations_fast_start_threshold = (max_fds / 2);
816 validations_running = 0; 812 validations_running = 0;
817 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validation uses a fast start threshold of %u connections and a delay between of %u ms\n ", 813 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validation uses a fast start threshold of %u connections and a delay between of %s\n ",
818 validations_fast_start_threshold, validation_delay.rel_value); 814 validations_fast_start_threshold,
815 GNUNET_STRINGS_relative_time_to_string (validation_delay,
816 GNUNET_YES));
819 validation_map = GNUNET_CONTAINER_multihashmap_create (VALIDATION_MAP_SIZE, 817 validation_map = GNUNET_CONTAINER_multihashmap_create (VALIDATION_MAP_SIZE,
820 GNUNET_NO); 818 GNUNET_NO);
821 pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES, &process_peerinfo_hello, NULL); 819 pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES, &process_peerinfo_hello, NULL);
@@ -1056,8 +1054,8 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
1056 GNUNET_assert (NULL != addrend); 1054 GNUNET_assert (NULL != addrend);
1057 memcpy (&((char *) &pong[1])[slen], addrend, alen); 1055 memcpy (&((char *) &pong[1])[slen], addrend, alen);
1058 } 1056 }
1059 if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value < 1057 if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us <
1060 PONG_SIGNATURE_LIFETIME.rel_value / 4) 1058 PONG_SIGNATURE_LIFETIME.rel_value_us / 4)
1061 { 1059 {
1062 /* create / update cached sig */ 1060 /* create / update cached sig */
1063 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1061 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1164,7 +1162,7 @@ validate_address_iterator (void *cls,
1164 const struct ValidateAddressContext *vac = cls; 1162 const struct ValidateAddressContext *vac = cls;
1165 struct ValidationEntry *ve; 1163 struct ValidationEntry *ve;
1166 1164
1167 if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) 1165 if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
1168 return GNUNET_OK; /* expired */ 1166 return GNUNET_OK; /* expired */
1169 ve = find_validation_entry (&vac->public_key, address); 1167 ve = find_validation_entry (&vac->public_key, address);
1170 if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task) 1168 if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task)
@@ -1261,7 +1259,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
1261 return; 1259 return;
1262 } 1260 }
1263 if (GNUNET_TIME_absolute_get_remaining 1261 if (GNUNET_TIME_absolute_get_remaining
1264 (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value == 0) 1262 (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value_us == 0)
1265 { 1263 {
1266 GNUNET_STATISTICS_update (GST_stats, 1264 GNUNET_STATISTICS_update (GST_stats,
1267 gettext_noop 1265 gettext_noop
@@ -1272,7 +1270,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
1272 1270
1273 sig_res = GNUNET_SYSERR; 1271 sig_res = GNUNET_SYSERR;
1274 do_verify = GNUNET_YES; 1272 do_verify = GNUNET_YES;
1275 if (0 != GNUNET_TIME_absolute_get_remaining(ve->pong_sig_valid_until).rel_value) 1273 if (0 != GNUNET_TIME_absolute_get_remaining(ve->pong_sig_valid_until).rel_value_us)
1276 { 1274 {
1277 /* We have a cached and valid signature for this peer, 1275 /* We have a cached and valid signature for this peer,
1278 * try to compare instead of verify */ 1276 * try to compare instead of verify */
@@ -1316,7 +1314,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
1316 { 1314 {
1317 struct GNUNET_ATS_Information ats[2]; 1315 struct GNUNET_ATS_Information ats[2];
1318 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 1316 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
1319 ats[0].value = htonl ((uint32_t) ve->latency.rel_value); 1317 ats[0].value = htonl ((uint32_t) ve->latency.rel_value_us);
1320 ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE); 1318 ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE);
1321 ats[1].value = htonl ((uint32_t) ve->network); 1319 ats[1].value = htonl ((uint32_t) ve->network);
1322 GNUNET_ATS_address_add (GST_ats, ve->address, NULL, ats, 2); 1320 GNUNET_ATS_address_add (GST_ats, ve->address, NULL, ats, 2);
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index c03d6a388..641261c05 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -264,14 +264,14 @@ shutdown_task (void *cls,
264 { 264 {
265 duration = GNUNET_TIME_absolute_get_duration (start_time); 265 duration = GNUNET_TIME_absolute_get_duration (start_time);
266 FPRINTF (stdout, _("Transmitted %llu bytes/s (%llu bytes in %s)\n"), 266 FPRINTF (stdout, _("Transmitted %llu bytes/s (%llu bytes in %s)\n"),
267 1000 * traffic_sent / (1 + duration.rel_value), traffic_sent, 267 1000LL * 1000LL * traffic_sent / (1 + duration.rel_value_us), traffic_sent,
268 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); 268 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
269 } 269 }
270 if (benchmark_receive) 270 if (benchmark_receive)
271 { 271 {
272 duration = GNUNET_TIME_absolute_get_duration (start_time); 272 duration = GNUNET_TIME_absolute_get_duration (start_time);
273 FPRINTF (stdout, _("Received %llu bytes/s (%llu bytes in %s)\n"), 273 FPRINTF (stdout, _("Received %llu bytes/s (%llu bytes in %s)\n"),
274 1000 * traffic_received / (1 + duration.rel_value), 274 1000LL * 1000LL * traffic_received / (1 + duration.rel_value_us),
275 traffic_received, 275 traffic_received,
276 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); 276 GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
277 } 277 }
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c
index 41500c34e..74fcd36a7 100644
--- a/src/transport/plugin_transport_bluetooth.c
+++ b/src/transport/plugin_transport_bluetooth.c
@@ -694,7 +694,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
694 694
695 session->timeout_task = GNUNET_SCHEDULER_NO_TASK; 695 session->timeout_task = GNUNET_SCHEDULER_NO_TASK;
696 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); 696 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout);
697 if (0 == timeout.rel_value) 697 if (0 == timeout.rel_value_us)
698 { 698 {
699 free_session (session); 699 free_session (session);
700 return; 700 return;
@@ -970,7 +970,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
970 970
971 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; 971 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK;
972 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); 972 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout);
973 if (0 == timeout.rel_value) 973 if (0 == timeout.rel_value_us)
974 { 974 {
975 free_macendpoint (endpoint); 975 free_macendpoint (endpoint);
976 return; 976 return;
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 88ab5cfed..937f4f62f 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -1261,8 +1261,10 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1261 1261
1262 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1262 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1263 GNUNET_log (TIMEOUT_LOG, 1263 GNUNET_log (TIMEOUT_LOG,
1264 "Session %p was idle for %llu ms, disconnecting\n", 1264 "Session %p was idle for %s, disconnecting\n",
1265 s, (unsigned long long) TIMEOUT.rel_value); 1265 s,
1266 GNUNET_STRINGS_relative_time_to_string (TIMEOUT,
1267 GNUNET_YES));
1266 1268
1267 /* call session destroy function */ 1269 /* call session destroy function */
1268 if (s->inbound == GNUNET_NO) 1270 if (s->inbound == GNUNET_NO)
@@ -1284,8 +1286,10 @@ start_session_timeout (struct Session *s)
1284 &session_timeout, 1286 &session_timeout,
1285 s); 1287 s);
1286 GNUNET_log (TIMEOUT_LOG, 1288 GNUNET_log (TIMEOUT_LOG,
1287 "Timeout for session %p set to %llu ms\n", 1289 "Timeout for session %p set to %s\n",
1288 s, (unsigned long long) TIMEOUT.rel_value); 1290 s,
1291 GNUNET_STRINGS_relative_time_to_string (TIMEOUT,
1292 GNUNET_YES));
1289} 1293}
1290 1294
1291 1295
@@ -1303,8 +1307,10 @@ reschedule_session_timeout (struct Session *s)
1303 &session_timeout, 1307 &session_timeout,
1304 s); 1308 s);
1305 GNUNET_log (TIMEOUT_LOG, 1309 GNUNET_log (TIMEOUT_LOG,
1306 "Timeout rescheduled for session %p set to %llu ms\n", 1310 "Timeout rescheduled for session %p set to %s\n",
1307 s, (unsigned long long) TIMEOUT.rel_value); 1311 s,
1312 GNUNET_STRINGS_relative_time_to_String (TIMEOUT,
1313 GNUNET_YES));
1308} 1314}
1309 1315
1310 1316
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 75daeab71..2d112d4fe 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -912,6 +912,7 @@ client_receive_mst_cb (void *cls, void *client,
912 struct GNUNET_TIME_Relative delay; 912 struct GNUNET_TIME_Relative delay;
913 struct GNUNET_ATS_Information atsi; 913 struct GNUNET_ATS_Information atsi;
914 char *stat_txt; 914 char *stat_txt;
915
915 if (GNUNET_YES != client_exist_session(p, s)) 916 if (GNUNET_YES != client_exist_session(p, s))
916 { 917 {
917 GNUNET_break (0); 918 GNUNET_break (0);
@@ -940,14 +941,16 @@ client_receive_mst_cb (void *cls, void *client,
940 s->next_receive = 941 s->next_receive =
941 GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); 942 GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay);
942 943
943 if (GNUNET_TIME_absolute_get ().abs_value < s->next_receive.abs_value) 944 if (GNUNET_TIME_absolute_get ().abs_value_us < s->next_receive.abs_value_us)
944 { 945 {
945
946 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 946 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
947 "Client: peer `%s' address `%s' next read delayed for %llu ms\n", 947 "Client: peer `%s' address `%s' next read delayed for %s\n",
948 GNUNET_i2s (&s->target), 948 GNUNET_i2s (&s->target),
949 http_common_plugin_address_to_string (NULL, s->plugin->protocol, s->addr, s->addrlen), 949 http_common_plugin_address_to_string (NULL,
950 delay); 950 s->plugin->protocol,
951 s->addr, s->addrlen),
952 GNUNET_STRINGS_relative_time_to_string (delay,
953 GNUNET_YES));
951 } 954 }
952 client_reschedule_session_timeout (s); 955 client_reschedule_session_timeout (s);
953 return GNUNET_OK; 956 return GNUNET_OK;
@@ -993,14 +996,16 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls)
993 s, s->client_get, 996 s, s->client_get,
994 len, GNUNET_i2s (&s->target)); 997 len, GNUNET_i2s (&s->target));
995 now = GNUNET_TIME_absolute_get (); 998 now = GNUNET_TIME_absolute_get ();
996 if (now.abs_value < s->next_receive.abs_value) 999 if (now.abs_value_us < s->next_receive.abs_value_us)
997 { 1000 {
998 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 1001 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
999 struct GNUNET_TIME_Relative delta = 1002 struct GNUNET_TIME_Relative delta =
1000 GNUNET_TIME_absolute_get_difference (now, s->next_receive); 1003 GNUNET_TIME_absolute_get_difference (now, s->next_receive);
1001 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, 1004 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
1002 "Session %p / connection %p: No inbound bandwidth available! Next read was delayed for %llu ms\n", 1005 "Session %p / connection %p: No inbound bandwidth available! Next read was delayed for %s\n",
1003 s, s->client_get, delta.rel_value); 1006 s, s->client_get,
1007 GNUNET_STRINGS_relative_time_to_string (delta,
1008 GNUNET_YES));
1004 if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK) 1009 if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK)
1005 { 1010 {
1006 GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); 1011 GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
@@ -1276,7 +1281,7 @@ client_connect_get (struct Session *s)
1276 curl_easy_setopt (s->client_get, CURLOPT_TIMEOUT, 0); 1281 curl_easy_setopt (s->client_get, CURLOPT_TIMEOUT, 0);
1277 curl_easy_setopt (s->client_get, CURLOPT_PRIVATE, s); 1282 curl_easy_setopt (s->client_get, CURLOPT_PRIVATE, s);
1278 curl_easy_setopt (s->client_get, CURLOPT_CONNECTTIMEOUT_MS, 1283 curl_easy_setopt (s->client_get, CURLOPT_CONNECTTIMEOUT_MS,
1279 (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value); 1284 (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL);
1280 curl_easy_setopt (s->client_get, CURLOPT_BUFFERSIZE, 1285 curl_easy_setopt (s->client_get, CURLOPT_BUFFERSIZE,
1281 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); 1286 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE);
1282#if CURL_TCP_NODELAY 1287#if CURL_TCP_NODELAY
@@ -1353,7 +1358,7 @@ client_connect_put (struct Session *s)
1353 curl_easy_setopt (s->client_put, CURLOPT_TIMEOUT, 0); 1358 curl_easy_setopt (s->client_put, CURLOPT_TIMEOUT, 0);
1354 curl_easy_setopt (s->client_put, CURLOPT_PRIVATE, s); 1359 curl_easy_setopt (s->client_put, CURLOPT_PRIVATE, s);
1355 curl_easy_setopt (s->client_put, CURLOPT_CONNECTTIMEOUT_MS, 1360 curl_easy_setopt (s->client_put, CURLOPT_CONNECTTIMEOUT_MS,
1356 (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value); 1361 (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL);
1357 curl_easy_setopt (s->client_put, CURLOPT_BUFFERSIZE, 1362 curl_easy_setopt (s->client_put, CURLOPT_BUFFERSIZE,
1358 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); 1363 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE);
1359#if CURL_TCP_NODELAY 1364#if CURL_TCP_NODELAY
@@ -1597,8 +1602,10 @@ client_session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
1597 1602
1598 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1603 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1599 GNUNET_log (TIMEOUT_LOG, 1604 GNUNET_log (TIMEOUT_LOG,
1600 "Session %p was idle for %llu ms, disconnecting\n", 1605 "Session %p was idle for %s, disconnecting\n",
1601 s, (unsigned long long) CLIENT_SESSION_TIMEOUT.rel_value); 1606 s,
1607 GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT,
1608 GNUNET_YES));
1602 1609
1603 /* call session destroy function */ 1610 /* call session destroy function */
1604 GNUNET_assert (GNUNET_OK == client_disconnect (s)); 1611 GNUNET_assert (GNUNET_OK == client_disconnect (s));
@@ -1620,8 +1627,10 @@ client_start_session_timeout (struct Session *s)
1620 &client_session_timeout, 1627 &client_session_timeout,
1621 s); 1628 s);
1622 GNUNET_log (TIMEOUT_LOG, 1629 GNUNET_log (TIMEOUT_LOG,
1623 "Timeout for session %p set to %llu ms\n", 1630 "Timeout for session %p set to %s\n",
1624 s, (unsigned long long) CLIENT_SESSION_TIMEOUT.rel_value); 1631 s,
1632 GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT,
1633 GNUNET_YES));
1625} 1634}
1626 1635
1627 1636
@@ -1642,8 +1651,10 @@ client_reschedule_session_timeout (struct Session *s)
1642 &client_session_timeout, 1651 &client_session_timeout,
1643 s); 1652 s);
1644 GNUNET_log (TIMEOUT_LOG, 1653 GNUNET_log (TIMEOUT_LOG,
1645 "Timeout rescheduled for session %p set to %llu ms\n", 1654 "Timeout rescheduled for session %p set to %s\n",
1646 s, (unsigned long long) CLIENT_SESSION_TIMEOUT.rel_value); 1655 s,
1656 GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT,
1657 GNUNET_YES));
1647} 1658}
1648 1659
1649 1660
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 19833521a..17e39360c 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2002-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
@@ -876,29 +876,42 @@ server_disconnect (struct Session *s)
876 return GNUNET_OK; 876 return GNUNET_OK;
877} 877}
878 878
879
880
881/**
882 * Tell MHD that the connection should timeout after #to seconds.
883 *
884 * @param plugin our plugin
885 * @param s session for which the timeout changes
886 * @param to timeout in seconds
887 */
879static void 888static void
880server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, struct Session *s, int to) 889server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin,
890 struct Session *s,
891 unsigned int to)
881{ 892{
882#if MHD_VERSION >= 0x00090E00 893#if MHD_VERSION >= 0x00090E00
883 /* Setting timeouts for other connections */ 894 /* Setting timeouts for other connections */
884 if (s->server_recv != NULL) 895 if (NULL != s->server_recv)
885 { 896 {
886 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 897 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
887 "Setting timeout for %p to %u sec.\n", s->server_recv, to); 898 "Setting timeout for %p to %u sec.\n",
888 MHD_set_connection_option (s->server_recv->mhd_conn, 899 s->server_recv, to);
889 MHD_CONNECTION_OPTION_TIMEOUT, 900 MHD_set_connection_option (s->server_recv->mhd_conn,
890 to); 901 MHD_CONNECTION_OPTION_TIMEOUT,
891 server_reschedule (plugin, s->server_recv->mhd_daemon, GNUNET_NO); 902 to);
892 } 903 server_reschedule (plugin, s->server_recv->mhd_daemon, GNUNET_NO);
893 if (s->server_send != NULL) 904 }
894 { 905 if (NULL != s->server_send)
895 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 906 {
896 "Setting timeout for %p to %u sec.\n", s->server_send, to); 907 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
897 MHD_set_connection_option (s->server_send->mhd_conn, 908 "Setting timeout for %p to %u sec.\n",
898 MHD_CONNECTION_OPTION_TIMEOUT, 909 s->server_send, to);
899 to); 910 MHD_set_connection_option (s->server_send->mhd_conn,
900 server_reschedule (plugin, s->server_send->mhd_daemon, GNUNET_NO); 911 MHD_CONNECTION_OPTION_TIMEOUT,
901 } 912 to);
913 server_reschedule (plugin, s->server_send->mhd_daemon, GNUNET_NO);
914 }
902#endif 915#endif
903} 916}
904 917
@@ -1034,14 +1047,12 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1034 struct ServerConnection *sc = NULL; 1047 struct ServerConnection *sc = NULL;
1035 const union MHD_ConnectionInfo *conn_info; 1048 const union MHD_ConnectionInfo *conn_info;
1036 struct GNUNET_ATS_Information ats; 1049 struct GNUNET_ATS_Information ats;
1037
1038 struct HttpAddress *addr; 1050 struct HttpAddress *addr;
1039 size_t addr_len; 1051 size_t addr_len;
1040
1041 struct GNUNET_PeerIdentity target; 1052 struct GNUNET_PeerIdentity target;
1042 uint32_t tag = 0; 1053 uint32_t tag = 0;
1043 int direction = GNUNET_SYSERR; 1054 int direction = GNUNET_SYSERR;
1044 int to; 1055 unsigned int to;
1045 1056
1046 conn_info = MHD_get_connection_info (mhd_connection, 1057 conn_info = MHD_get_connection_info (mhd_connection,
1047 MHD_CONNECTION_INFO_CLIENT_ADDRESS); 1058 MHD_CONNECTION_INFO_CLIENT_ADDRESS);
@@ -1169,8 +1180,9 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1169#if MHD_VERSION >= 0x00090E00 1180#if MHD_VERSION >= 0x00090E00
1170 if ((NULL == s->server_recv) || (NULL == s->server_send)) 1181 if ((NULL == s->server_recv) || (NULL == s->server_send))
1171 { 1182 {
1172 to = (HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value / 1000); 1183 to = (HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL);
1173 MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to); 1184 MHD_set_connection_option (mhd_connection,
1185 MHD_CONNECTION_OPTION_TIMEOUT, to);
1174 server_reschedule (plugin, sc->mhd_daemon, GNUNET_NO); 1186 server_reschedule (plugin, sc->mhd_daemon, GNUNET_NO);
1175 } 1187 }
1176 else 1188 else
@@ -1178,7 +1190,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1178 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1190 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1179 "Session %p for peer `%s' fully connected\n", 1191 "Session %p for peer `%s' fully connected\n",
1180 s, GNUNET_i2s (&target)); 1192 s, GNUNET_i2s (&target));
1181 to = (SERVER_SESSION_TIMEOUT.rel_value / 1000); 1193 to = (SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL);
1182 server_mhd_connection_timeout (plugin, s, to); 1194 server_mhd_connection_timeout (plugin, s, to);
1183 } 1195 }
1184 1196
@@ -1325,13 +1337,14 @@ server_receive_mst_cb (void *cls, void *client,
1325 1337
1326 s->session_passed = GNUNET_YES; 1338 s->session_passed = GNUNET_YES;
1327 s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); 1339 s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay);
1328 if (delay.rel_value > 0) 1340 if (delay.rel_value_us > 0)
1329 { 1341 {
1330 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1342 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1331 "Peer `%s' address `%s' next read delayed for %llu ms\n", 1343 "Peer `%s' address `%s' next read delayed for %s\n",
1332 GNUNET_i2s (&s->target), 1344 GNUNET_i2s (&s->target),
1333 http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen), 1345 http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen),
1334 delay); 1346 GNUNET_STRINGS_relative_time_to_string (delay,
1347 GNUNET_YES));
1335 } 1348 }
1336 server_reschedule_session_timeout (s); 1349 server_reschedule_session_timeout (s);
1337 return GNUNET_OK; 1350 return GNUNET_OK;
@@ -1477,7 +1490,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1477 *upload_data_size); 1490 *upload_data_size);
1478 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); 1491 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
1479 1492
1480 if ((s->next_receive.abs_value <= now.abs_value)) 1493 if ((s->next_receive.abs_value_us <= now.abs_value_us))
1481 { 1494 {
1482 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1495 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1483 "PUT with %u bytes forwarded to MST\n", 1496 "PUT with %u bytes forwarded to MST\n",
@@ -1488,16 +1501,17 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1488 } 1501 }
1489 GNUNET_SERVER_mst_receive (s->msg_tk, s, upload_data, 1502 GNUNET_SERVER_mst_receive (s->msg_tk, s, upload_data,
1490 *upload_data_size, GNUNET_NO, GNUNET_NO); 1503 *upload_data_size, GNUNET_NO, GNUNET_NO);
1491#if MHD_VERSION >= 0x00090E00 1504 server_mhd_connection_timeout (plugin, s,
1492 server_mhd_connection_timeout (plugin, s, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000); 1505 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us / 1000LL / 1000LL);
1493#endif
1494 (*upload_data_size) = 0; 1506 (*upload_data_size) = 0;
1495 } 1507 }
1496 else 1508 else
1497 { 1509 {
1498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1510 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1499 "Session %p / Connection %p: no inbound bandwidth available! Next read was delayed by %llu ms\n", 1511 "Session %p / Connection %p: no inbound bandwidth available! Next read was delayed by %s\n",
1500 s, sc, now.abs_value - s->next_receive.abs_value); 1512 s, sc,
1513 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (s->next_receive),
1514 GNUNET_YES));
1501 } 1515 }
1502 return MHD_YES; 1516 return MHD_YES;
1503 } 1517 }
@@ -1753,12 +1767,12 @@ server_schedule (struct HTTP_Server_Plugin *plugin,
1753 { 1767 {
1754 1768
1755 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1769 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1756 "SELECT Timeout changed from %llu to %llu\n", 1770 "SELECT Timeout changed from %llu to %llu (ms)\n",
1757 last_timeout, timeout); 1771 last_timeout, timeout);
1758 last_timeout = timeout; 1772 last_timeout = timeout;
1759 } 1773 }
1760 if (timeout <= GNUNET_TIME_UNIT_SECONDS.rel_value) 1774 if (timeout <= GNUNET_TIME_UNIT_SECONDS.rel_value_us / 1000LL)
1761 tv.rel_value = (uint64_t) timeout; 1775 tv.rel_value_us = (uint64_t) timeout * 1000LL;
1762 else 1776 else
1763 tv = GNUNET_TIME_UNIT_SECONDS; 1777 tv = GNUNET_TIME_UNIT_SECONDS;
1764 } 1778 }
@@ -2007,12 +2021,12 @@ server_start (struct HTTP_Server_Plugin *plugin)
2007 2021
2008 2022
2009#if MHD_VERSION >= 0x00090E00 2023#if MHD_VERSION >= 0x00090E00
2010 timeout = HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value / 1000; 2024 timeout = HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL;
2011 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 2025 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
2012 "MHD can set timeout per connection! Default time out %u sec.\n", 2026 "MHD can set timeout per connection! Default time out %u sec.\n",
2013 timeout); 2027 timeout);
2014#else 2028#else
2015 timeout = SERVER_SESSION_TIMEOUT.rel_value / 1000; 2029 timeout = SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL;
2016 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, 2030 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name,
2017 "MHD cannot set timeout per connection! Default time out %u sec.\n", 2031 "MHD cannot set timeout per connection! Default time out %u sec.\n",
2018 timeout); 2032 timeout);
@@ -2870,8 +2884,10 @@ server_session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
2870 2884
2871 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2885 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2872 GNUNET_log (TIMEOUT_LOG, 2886 GNUNET_log (TIMEOUT_LOG,
2873 "Session %p was idle for %llu ms, disconnecting\n", 2887 "Session %p was idle for %s, disconnecting\n",
2874 s, (unsigned long long) SERVER_SESSION_TIMEOUT.rel_value); 2888 s,
2889 GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT,
2890 GNUNET_YES));
2875 2891
2876 /* call session destroy function */ 2892 /* call session destroy function */
2877 GNUNET_assert (GNUNET_OK == server_disconnect (s)); 2893 GNUNET_assert (GNUNET_OK == server_disconnect (s));
@@ -2892,8 +2908,10 @@ server_start_session_timeout (struct Session *s)
2892 &server_session_timeout, 2908 &server_session_timeout,
2893 s); 2909 s);
2894 GNUNET_log (TIMEOUT_LOG, 2910 GNUNET_log (TIMEOUT_LOG,
2895 "Timeout for session %p set to %llu ms\n", 2911 "Timeout for session %p set to %s\n",
2896 s, (unsigned long long) SERVER_SESSION_TIMEOUT.rel_value); 2912 s,
2913 GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT,
2914 GNUNET_YES));
2897} 2915}
2898 2916
2899 2917
@@ -2913,8 +2931,10 @@ server_reschedule_session_timeout (struct Session *s)
2913 &server_session_timeout, 2931 &server_session_timeout,
2914 s); 2932 s);
2915 GNUNET_log (TIMEOUT_LOG, 2933 GNUNET_log (TIMEOUT_LOG,
2916 "Timeout rescheduled for session %p set to %llu ms\n", 2934 "Timeout rescheduled for session %p set to %s\n",
2917 s, (unsigned long long) SERVER_SESSION_TIMEOUT.rel_value); 2935 s,
2936 GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT,
2937 GNUNET_YES));
2918} 2938}
2919 2939
2920 2940
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index dc0beb73f..b1c4cab2b 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2002--2012 Christian Grothoff (and other contributing authors) 3 (C) 2002--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
@@ -897,7 +897,7 @@ do_transmit (void *cls, size_t size, void *buf)
897 ret = 0; 897 ret = 0;
898 now = GNUNET_TIME_absolute_get (); 898 now = GNUNET_TIME_absolute_get ();
899 while ((NULL != (pos = session->pending_messages_head)) && 899 while ((NULL != (pos = session->pending_messages_head)) &&
900 (pos->timeout.abs_value <= now.abs_value)) 900 (pos->timeout.abs_value_us <= now.abs_value_us))
901 { 901 {
902 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, 902 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
903 session->pending_messages_tail, pos); 903 session->pending_messages_tail, pos);
@@ -2269,16 +2269,16 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
2269 2269
2270 reschedule_session_timeout (session); 2270 reschedule_session_timeout (session);
2271 2271
2272 if (delay.rel_value == 0) 2272 if (0 == delay.rel_value_us)
2273 { 2273 {
2274 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2274 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2275 } 2275 }
2276 else 2276 else
2277 { 2277 {
2278 LOG (GNUNET_ERROR_TYPE_DEBUG, 2278 LOG (GNUNET_ERROR_TYPE_DEBUG,
2279 "Throttling receiving from `%s' for %llu ms\n", 2279 "Throttling receiving from `%s' for %s\n",
2280 GNUNET_i2s (&session->target), 2280 GNUNET_i2s (&session->target),
2281 (unsigned long long) delay.rel_value); 2281 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
2282 GNUNET_SERVER_disable_receive_done_warning (client); 2282 GNUNET_SERVER_disable_receive_done_warning (client);
2283 session->receive_delay_task = 2283 session->receive_delay_task =
2284 GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); 2284 GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
@@ -2426,8 +2426,10 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2426 2426
2427 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2427 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2428 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2428 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2429 "Session %p was idle for %llu ms, disconnecting\n", 2429 "Session %p was idle for %s, disconnecting\n",
2430 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 2430 s,
2431 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
2432 GNUNET_YES));
2431 /* call session destroy function */ 2433 /* call session destroy function */
2432 disconnect_session(s); 2434 disconnect_session(s);
2433} 2435}
@@ -2445,8 +2447,10 @@ start_session_timeout (struct Session *s)
2445 &session_timeout, 2447 &session_timeout,
2446 s); 2448 s);
2447 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2449 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2448 "Timeout for session %p set to %llu ms\n", 2450 "Timeout for session %p set to %s\n",
2449 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 2451 s,
2452 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
2453 GNUNET_YES));
2450} 2454}
2451 2455
2452 2456
@@ -2464,8 +2468,10 @@ reschedule_session_timeout (struct Session *s)
2464 &session_timeout, 2468 &session_timeout,
2465 s); 2469 s);
2466 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2470 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2467 "Timeout rescheduled for session %p set to %llu ms\n", 2471 "Timeout rescheduled for session %p set to %s\n",
2468 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 2472 s,
2473 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
2474 GNUNET_YES));
2469} 2475}
2470 2476
2471 2477
@@ -2483,7 +2489,7 @@ stop_session_timeout (struct Session *s)
2483 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2489 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2490 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2485 "Timeout stopped for session %p canceled\n", 2491 "Timeout stopped for session %p canceled\n",
2486 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 2492 s);
2487 } 2493 }
2488} 2494}
2489 2495
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index be19c5de3..cb95a5a00 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2010, 2011 Christian Grothoff (and other contributing authors) 3 (C) 2010-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
@@ -509,9 +509,9 @@ schedule_select (struct Plugin *plugin)
509 * - timeout minimum delay */ 509 * - timeout minimum delay */
510 plugin->select_task = 510 plugin->select_task =
511 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 511 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
512 (0 == min_delay.rel_value) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, 512 (0 == min_delay.rel_value_us) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay,
513 plugin->rs_v4, 513 plugin->rs_v4,
514 (0 == min_delay.rel_value) ? plugin->ws_v4 : NULL, 514 (0 == min_delay.rel_value_us) ? plugin->ws_v4 : NULL,
515 &udp_plugin_select, plugin); 515 &udp_plugin_select, plugin);
516 } 516 }
517 if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6)) 517 if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6))
@@ -525,9 +525,9 @@ schedule_select (struct Plugin *plugin)
525 GNUNET_SCHEDULER_cancel(plugin->select_task_v6); 525 GNUNET_SCHEDULER_cancel(plugin->select_task_v6);
526 plugin->select_task_v6 = 526 plugin->select_task_v6 =
527 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 527 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
528 (0 == min_delay.rel_value) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, 528 (0 == min_delay.rel_value_us) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay,
529 plugin->rs_v6, 529 plugin->rs_v6,
530 (0 == min_delay.rel_value) ? plugin->ws_v6 : NULL, 530 (0 == min_delay.rel_value_us) ? plugin->ws_v6 : NULL,
531 &udp_plugin_select_v6, plugin); 531 &udp_plugin_select_v6, plugin);
532 } 532 }
533} 533}
@@ -1328,8 +1328,10 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1328 1328
1329 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1329 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1331 "Session %p was idle for %llu ms, disconnecting\n", 1331 "Session %p was idle for %s, disconnecting\n",
1332 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 1332 s,
1333 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1334 GNUNET_YES));
1333 /* call session destroy function */ 1335 /* call session destroy function */
1334 disconnect_session (s); 1336 disconnect_session (s);
1335} 1337}
@@ -1347,8 +1349,10 @@ start_session_timeout (struct Session *s)
1347 &session_timeout, 1349 &session_timeout,
1348 s); 1350 s);
1349 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1351 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1350 "Timeout for session %p set to %llu ms\n", 1352 "Timeout for session %p set to %s\n",
1351 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 1353 s,
1354 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1355 GNUNET_YES));
1352} 1356}
1353 1357
1354 1358
@@ -1366,8 +1370,10 @@ reschedule_session_timeout (struct Session *s)
1366 &session_timeout, 1370 &session_timeout,
1367 s); 1371 s);
1368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1369 "Timeout rescheduled for session %p set to %llu ms\n", 1373 "Timeout rescheduled for session %p set to %s\n",
1370 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 1374 s,
1375 GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1376 GNUNET_YES));
1371} 1377}
1372 1378
1373 1379
@@ -1385,7 +1391,7 @@ stop_session_timeout (struct Session *s)
1385 s->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1391 s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1386 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1392 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1387 "Timeout stopped for session %p canceled\n", 1393 "Timeout stopped for session %p canceled\n",
1388 s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); 1394 s);
1389 } 1395 }
1390} 1396}
1391 1397
@@ -2173,16 +2179,17 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg)
2173 if (NULL == s) 2179 if (NULL == s)
2174 return; 2180 return;
2175 2181
2176 if (s->flow_delay_for_other_peer.rel_value <= UINT32_MAX) 2182 if (s->flow_delay_for_other_peer.rel_value_us <= UINT32_MAX)
2177 delay = s->flow_delay_for_other_peer.rel_value; 2183 delay = s->flow_delay_for_other_peer.rel_value_us;
2178 2184
2179 LOG (GNUNET_ERROR_TYPE_DEBUG, 2185 LOG (GNUNET_ERROR_TYPE_DEBUG,
2180 "Sending ACK to `%s' including delay of %u ms\n", 2186 "Sending ACK to `%s' including delay of %s\n",
2181 GNUNET_a2s (rc->src_addr, 2187 GNUNET_a2s (rc->src_addr,
2182 (rc->src_addr->sa_family == 2188 (rc->src_addr->sa_family ==
2183 AF_INET) ? sizeof (struct sockaddr_in) : sizeof (struct 2189 AF_INET) ? sizeof (struct sockaddr_in) : sizeof (struct
2184 sockaddr_in6)), 2190 sockaddr_in6)),
2185 delay); 2191 GNUNET_STRINGS_relative_time_to_string (s->flow_delay_for_other_peer,
2192 GNUNET_YES));
2186 udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + msize); 2193 udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + msize);
2187 udpw->msg_size = msize; 2194 udpw->msg_size = msize;
2188 udpw->payload_size = 0; 2195 udpw->payload_size = 0;
@@ -2248,10 +2255,11 @@ read_process_ack (struct Plugin *plugin,
2248 return; 2255 return;
2249 } 2256 }
2250 2257
2251 flow_delay.rel_value = (uint64_t) ntohl (udp_ack->delay); 2258 flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay);
2252 LOG (GNUNET_ERROR_TYPE_DEBUG, 2259 LOG (GNUNET_ERROR_TYPE_DEBUG,
2253 "We received a sending delay of %llu\n", 2260 "We received a sending delay of %s\n",
2254 flow_delay.rel_value); 2261 GNUNET_STRINGS_relative_time_to_string (flow_delay,
2262 GNUNET_YES));
2255 s->flow_delay_from_other_peer = 2263 s->flow_delay_from_other_peer =
2256 GNUNET_TIME_relative_to_absolute (flow_delay); 2264 GNUNET_TIME_relative_to_absolute (flow_delay);
2257 2265
@@ -2324,7 +2332,7 @@ read_process_fragment (struct Plugin *plugin,
2324 d_ctx->hnode = 2332 d_ctx->hnode =
2325 GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs, d_ctx, 2333 GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs, d_ctx,
2326 (GNUNET_CONTAINER_HeapCostType) 2334 (GNUNET_CONTAINER_HeapCostType)
2327 now.abs_value); 2335 now.abs_value_us);
2328 LOG (GNUNET_ERROR_TYPE_DEBUG, 2336 LOG (GNUNET_ERROR_TYPE_DEBUG,
2329 "Created new defragmentation context for %u-byte fragment from `%s'\n", 2337 "Created new defragmentation context for %u-byte fragment from `%s'\n",
2330 (unsigned int) ntohs (msg->size), 2338 (unsigned int) ntohs (msg->size),
@@ -2343,7 +2351,7 @@ read_process_fragment (struct Plugin *plugin,
2343 /* keep this 'rc' from expiring */ 2351 /* keep this 'rc' from expiring */
2344 GNUNET_CONTAINER_heap_update_cost (plugin->defrag_ctxs, d_ctx->hnode, 2352 GNUNET_CONTAINER_heap_update_cost (plugin->defrag_ctxs, d_ctx->hnode,
2345 (GNUNET_CONTAINER_HeapCostType) 2353 (GNUNET_CONTAINER_HeapCostType)
2346 now.abs_value); 2354 now.abs_value_us);
2347 } 2355 }
2348 if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) > 2356 if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) >
2349 UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG) 2357 UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG)
@@ -2459,7 +2467,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head,
2459 { 2467 {
2460 /* Find messages with timeout */ 2468 /* Find messages with timeout */
2461 remaining = GNUNET_TIME_absolute_get_remaining (udpw->timeout); 2469 remaining = GNUNET_TIME_absolute_get_remaining (udpw->timeout);
2462 if (GNUNET_TIME_UNIT_ZERO.rel_value == remaining.rel_value) 2470 if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us)
2463 { 2471 {
2464 /* Message timed out */ 2472 /* Message timed out */
2465 switch (udpw->msg_type) { 2473 switch (udpw->msg_type) {
@@ -2542,7 +2550,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head,
2542 { 2550 {
2543 /* Message did not time out, check flow delay */ 2551 /* Message did not time out, check flow delay */
2544 remaining = GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer); 2552 remaining = GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer);
2545 if (GNUNET_TIME_UNIT_ZERO.rel_value == remaining.rel_value) 2553 if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us)
2546 { 2554 {
2547 /* this message is not delayed */ 2555 /* this message is not delayed */
2548 LOG (GNUNET_ERROR_TYPE_DEBUG, 2556 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -2554,8 +2562,10 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head,
2554 { 2562 {
2555 /* Message is delayed, try next */ 2563 /* Message is delayed, try next */
2556 LOG (GNUNET_ERROR_TYPE_DEBUG, 2564 LOG (GNUNET_ERROR_TYPE_DEBUG,
2557 "Message for peer `%s' (%u bytes) is delayed for %llu \n", 2565 "Message for peer `%s' (%u bytes) is delayed for %s\n",
2558 GNUNET_i2s(&udpw->session->target), udpw->payload_size, remaining.rel_value); 2566 GNUNET_i2s(&udpw->session->target), udpw->payload_size,
2567 GNUNET_STRINGS_relative_time_to_string (remaining,
2568 GNUNET_YES));
2559 udpw = udpw->next; 2569 udpw = udpw->next;
2560 } 2570 }
2561 } 2571 }
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 19a4d8e60..211408f18 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -1080,7 +1080,7 @@ unix_plugin_select_write (struct Plugin *plugin)
1080 1080
1081 while (NULL != (msgw = plugin->msg_tail)) 1081 while (NULL != (msgw = plugin->msg_tail))
1082 { 1082 {
1083 if (GNUNET_TIME_absolute_get_remaining (msgw->timeout).rel_value > 0) 1083 if (GNUNET_TIME_absolute_get_remaining (msgw->timeout).rel_value_us > 0)
1084 break; /* Message is ready for sending */ 1084 break; /* Message is ready for sending */
1085 /* Message has a timeout */ 1085 /* Message has a timeout */
1086 LOG (GNUNET_ERROR_TYPE_DEBUG, 1086 LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index a376a2642..42ed771f4 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -692,7 +692,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
692 692
693 session->timeout_task = GNUNET_SCHEDULER_NO_TASK; 693 session->timeout_task = GNUNET_SCHEDULER_NO_TASK;
694 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); 694 timeout = GNUNET_TIME_absolute_get_remaining (session->timeout);
695 if (0 == timeout.rel_value) 695 if (0 == timeout.rel_value_us)
696 { 696 {
697 free_session (session); 697 free_session (session);
698 return; 698 return;
@@ -1003,7 +1003,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1003 1003
1004 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1004 endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1005 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); 1005 timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout);
1006 if (0 == timeout.rel_value) 1006 if (0 == timeout.rel_value_us)
1007 { 1007 {
1008 free_macendpoint (endpoint); 1008 free_macendpoint (endpoint);
1009 return; 1009 return;
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 37960e204..0dfe27c64 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -129,8 +129,8 @@ end ()
129 129
130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); 130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
131 131
132 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; 132 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
133 datarate = (total_bytes_sent * 1000) / delta; 133 datarate = (total_bytes_sent * 1000 * 1000) / delta;
134 134
135 FPRINTF (stderr, "Throughput was %llu b/s\n", datarate); 135 FPRINTF (stderr, "Throughput was %llu b/s\n", datarate);
136 136
@@ -398,7 +398,7 @@ measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
398 measure_task = GNUNET_SCHEDULER_NO_TASK; 398 measure_task = GNUNET_SCHEDULER_NO_TASK;
399 399
400 counter++; 400 counter++;
401 if ((DURATION.rel_value / 1000) < counter) 401 if ((DURATION.rel_value_us / 1000 / 1000LL) < counter)
402 { 402 {
403 FPRINTF (stderr, "%s", ".\n"); 403 FPRINTF (stderr, "%s", ".\n");
404 GNUNET_SCHEDULER_add_now (&end, NULL); 404 GNUNET_SCHEDULER_add_now (&end, NULL);
diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c
index b7321af85..c9bb5d08a 100644
--- a/src/transport/test_transport_api_manipulation_cfg.c
+++ b/src/transport/test_transport_api_manipulation_cfg.c
@@ -25,8 +25,8 @@
25 * Peer 1 has inbound and outbound delay of 100ms 25 * Peer 1 has inbound and outbound delay of 100ms
26 * Peer 2 has no inbound and outbound delay 26 * Peer 2 has no inbound and outbound delay
27 * 27 *
28 * We send a request from P1 to P2 and expect delay of >= TEST_DELAY ms 28 * We send a request from P1 to P2 and expect delay of >= TEST_DELAY us
29 * Then we send response from P2 to P1 and expect delay of >= TEST_DELAY ms 29 * Then we send response from P2 to P1 and expect delay of >= TEST_DELAY us
30 */ 30 */
31#include "platform.h" 31#include "platform.h"
32#include "gnunet_transport_service.h" 32#include "gnunet_transport_service.h"
@@ -48,7 +48,10 @@
48 48
49#define TEST_RESPONSE_MESSAGE_TYPE 12346 49#define TEST_RESPONSE_MESSAGE_TYPE 12346
50 50
51#define TEST_DELAY 100 51/**
52 * Test delay, in microseconds.
53 */
54#define TEST_DELAY 100 * 1000LL
52 55
53static char *test_source; 56static char *test_source;
54 57
@@ -304,16 +307,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
304 case TEST_REQUEST_MESSAGE_TYPE: 307 case TEST_REQUEST_MESSAGE_TYPE:
305 duration = GNUNET_TIME_absolute_get_difference(start_request, 308 duration = GNUNET_TIME_absolute_get_difference(start_request,
306 GNUNET_TIME_absolute_get()); 309 GNUNET_TIME_absolute_get());
307 if (duration.rel_value >= TEST_DELAY) 310 if (duration.rel_value_us >= TEST_DELAY)
308 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 311 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
309 "Request message was delayed for %llu ms\n", 312 "Request message was delayed for %s\n",
310 duration.rel_value); 313 GNUNET_STRINGS_relative_time_to_string (duration,
314 GNUNET_YES));
311 else 315 else
312 { 316 {
313 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 317 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
314 "Request message was delayed for %llu ms, should be %u ms\n", 318 "Request message was delayed for unexpected duration %s\n",
315 duration.rel_value, TEST_DELAY); 319 GNUNET_STRINGS_relative_time_to_string (duration,
316 ok = 1; 320 GNUNET_YES));
321 ok = 1;
317 } 322 }
318 323
319 /* Send response */ 324 /* Send response */
@@ -323,15 +328,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
323 case TEST_RESPONSE_MESSAGE_TYPE: 328 case TEST_RESPONSE_MESSAGE_TYPE:
324 duration = GNUNET_TIME_absolute_get_difference(start_response, 329 duration = GNUNET_TIME_absolute_get_difference(start_response,
325 GNUNET_TIME_absolute_get()); 330 GNUNET_TIME_absolute_get());
326 if (duration.rel_value >= TEST_DELAY) 331 if (duration.rel_value_us >= TEST_DELAY)
327 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 332 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
328 "Response message was delayed for %llu ms\n", duration); 333 "Response message was delayed for %s\n",
334 GNUNET_STRINGS_relative_time_to_string (duration,
335 GNUNET_YES));
329 else 336 else
330 { 337 {
331 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 338 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
332 "Response message was delayed for %llu ms, should be %u ms\n", 339 "Response message was delayed for unexpected duration %s\n",
333 duration.rel_value, TEST_DELAY); 340 GNUNET_STRINGS_relative_time_to_string (duration,
334 ok = 1; 341 GNUNET_YES));
342 ok = 1;
335 } 343 }
336 /* Done */ 344 /* Done */
337 ok = 0; 345 ok = 0;
diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c b/src/transport/test_transport_api_manipulation_recv_tcp.c
index 83d1431dc..a91866be4 100644
--- a/src/transport/test_transport_api_manipulation_recv_tcp.c
+++ b/src/transport/test_transport_api_manipulation_recv_tcp.c
@@ -200,13 +200,14 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
200 /* Received non-delayed message */ 200 /* Received non-delayed message */
201 dur_normal = GNUNET_TIME_absolute_get_duration(start_normal); 201 dur_normal = GNUNET_TIME_absolute_get_duration(start_normal);
202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
203 "Received non-delayed message %u after %llu\n", 203 "Received non-delayed message %u after %s\n",
204 messages_recv, 204 messages_recv,
205 (long long unsigned int) dur_normal.rel_value); 205 GNUNET_STRINGS_relative_time_to_string (dur_normal,
206 GNUNET_YES));
206 207
207 struct GNUNET_ATS_Information ats[2]; 208 struct GNUNET_ATS_Information ats[2];
208 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 209 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
209 ats[0].value = htonl (1000); 210 ats[0].value = htonl (1000 * 1000LL);
210 ats[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); 211 ats[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
211 ats[1].value = htonl (10); 212 ats[1].value = htonl (10);
212 213
@@ -218,16 +219,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
218 /* Received manipulated message */ 219 /* Received manipulated message */
219 dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed); 220 dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed);
220 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 221 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
221 "Received delayed message %u after %llu\n", 222 "Received delayed message %u after %s\n",
222 messages_recv, 223 messages_recv,
223 (long long unsigned int) dur_delayed.rel_value); 224 GNUNET_STRINGS_relative_time_to_string (dur_delayed,
224 if (dur_delayed.rel_value < 1000) 225 GNUNET_YES));
226 if (dur_delayed.rel_value_us < 1000 * 1000LL)
225 { 227 {
226 GNUNET_break (0); 228 GNUNET_break (0);
227 ok += 1; 229 ok += 1;
228 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 230 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
229 "Delayed message was not delayed correctly: took only %llu\n", 231 "Delayed message was not delayed correctly: took only %s\n",
230 (long long unsigned int) dur_delayed.rel_value); 232 GNUNET_STRINGS_relative_time_to_string (dur_delayed,
233 GNUNET_YES));
231 } 234 }
232 /* shutdown */ 235 /* shutdown */
233 end (); 236 end ();
diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c
index 5361e0aba..2b7fdc250 100644
--- a/src/transport/test_transport_api_manipulation_send_tcp.c
+++ b/src/transport/test_transport_api_manipulation_send_tcp.c
@@ -200,9 +200,10 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
200 /* Received non-delayed message */ 200 /* Received non-delayed message */
201 dur_normal = GNUNET_TIME_absolute_get_duration(start_normal); 201 dur_normal = GNUNET_TIME_absolute_get_duration(start_normal);
202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
203 "Received non-delayed message %u after %llu\n", 203 "Received non-delayed message %u after %s\n",
204 messages_recv, 204 messages_recv,
205 (long long unsigned int) dur_normal.rel_value); 205 GNUNET_STRINGS_relative_time_to_string (dur_normal,
206 GNUNET_YES));
206 send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL); 207 send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL);
207 } 208 }
208 if (1 == messages_recv) 209 if (1 == messages_recv)
@@ -210,16 +211,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
210 /* Received manipulated message */ 211 /* Received manipulated message */
211 dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed); 212 dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed);
212 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 213 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
213 "Received delayed message %u after %llu\n", 214 "Received delayed message %u after %s\n",
214 messages_recv, 215 messages_recv,
215 (long long unsigned int) dur_delayed.rel_value); 216 GNUNET_STRINGS_relative_time_to_string (dur_delayed,
216 if (dur_delayed.rel_value < 1000) 217 GNUNET_YES));
218 if (dur_delayed.rel_value_us < 1000 * 1000LL)
217 { 219 {
218 GNUNET_break (0); 220 GNUNET_break (0);
219 ok += 1; 221 ok += 1;
220 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 222 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
221 "Delayed message was not delayed correctly: took only %llu\n", 223 "Delayed message was not delayed correctly: took only %s\n",
222 (long long unsigned int) dur_delayed.rel_value); 224 GNUNET_STRINGS_relative_time_to_string (dur_delayed,
225 GNUNET_YES));
223 } 226 }
224 227
225 /* shutdown */ 228 /* shutdown */
@@ -291,7 +294,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
291 if (1 == messages_recv) 294 if (1 == messages_recv)
292 { 295 {
293 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 296 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
294 ats[0].value = htonl (1000); 297 ats[0].value = htonl (1000LL * 1000LL);
295 GNUNET_TRANSPORT_set_traffic_metric (p2->th, &p1->id, GNUNET_NO, GNUNET_YES, ats, 1); 298 GNUNET_TRANSPORT_set_traffic_metric (p2->th, &p1->id, GNUNET_NO, GNUNET_YES, ats, 1);
296 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); 299 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
297 ats[0].value = htonl (10); 300 ats[0].value = htonl (10);
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 2993a224d..d129350c2 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -123,11 +123,11 @@ end ()
123 123
124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); 124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
125 125
126 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; 126 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
127 FPRINTF (stderr, "\nThroughput was %llu kb/s\n", 127 FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
128 total_bytes * 1000 / 1024 / delta); 128 total_bytes * 1024 / delta);
129 GNUNET_asprintf (&value_name, "reliable_%s", test_plugin); 129 GNUNET_asprintf (&value_name, "reliable_%s", test_plugin);
130 GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), 130 GAUGER ("TRANSPORT", value_name, (int) (total_bytes / 1024 / delta),
131 "kb/s"); 131 "kb/s");
132 GNUNET_free (value_name); 132 GNUNET_free (value_name);
133 133
diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c
index a3bef6b94..908374cb7 100644
--- a/src/transport/test_transport_api_timeout.c
+++ b/src/transport/test_transport_api_timeout.c
@@ -111,8 +111,10 @@ end ()
111 { 111 {
112 ok = disconnects; 112 ok = disconnects;
113 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 113 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
114 "Fail! Had %u disconnects while waiting %llu seconds \n", 114 "Fail! Had %u disconnects while waiting %s\n",
115 disconnects, WAIT.rel_value); 115 disconnects,
116 GNUNET_STRINGS_relative_time_to_string (WAIT,
117 GNUNET_YES));
116 } 118 }
117 119
118 GNUNET_TRANSPORT_TESTING_done (tth); 120 GNUNET_TRANSPORT_TESTING_done (tth);
@@ -193,8 +195,8 @@ timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
193 GNUNET_TIME_relative_add (time_running, 195 GNUNET_TIME_relative_add (time_running,
194 GNUNET_TIME_relative_divide (WAIT, 10)); 196 GNUNET_TIME_relative_divide (WAIT, 10));
195 197
196 if (time_running.rel_value == 198 if (time_running.rel_value_us ==
197 GNUNET_TIME_relative_max (time_running, WAIT).rel_value) 199 GNUNET_TIME_relative_max (time_running, WAIT).rel_value_us)
198 { 200 {
199 FPRINTF (stderr, "%s", "100%%\n"); 201 FPRINTF (stderr, "%s", "100%%\n");
200 shutdown_flag = GNUNET_YES; 202 shutdown_flag = GNUNET_YES;
@@ -221,7 +223,10 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
221 223
222 shutdown_flag = GNUNET_NO; 224 shutdown_flag = GNUNET_NO;
223 225
224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for %llu seconds\n", (WAIT.rel_value) / 1000); 226 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
227 "Waiting for %s\n",
228 GNUNET_STRINGS_relative_time_to_string (WAIT,
229 GNUNET_YES));
225 230
226 if (die_task != GNUNET_SCHEDULER_NO_TASK) 231 if (die_task != GNUNET_SCHEDULER_NO_TASK)
227 GNUNET_SCHEDULER_cancel (die_task); 232 GNUNET_SCHEDULER_cancel (die_task);
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c
index afc26cef7..9bae154de 100644
--- a/src/transport/test_transport_api_unreliability.c
+++ b/src/transport/test_transport_api_unreliability.c
@@ -131,11 +131,11 @@ end ()
131 131
132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); 132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
133 133
134 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; 134 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
135 FPRINTF (stderr, "\nThroughput was %llu kb/s\n", 135 FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
136 total_bytes * 1000 / 1024 / delta); 136 total_bytes * 1024 / delta);
137 GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin); 137 GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin);
138 GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), 138 GAUGER ("TRANSPORT", value_name, (int) (total_bytes / 1024 / delta),
139 "kb/s"); 139 "kb/s");
140 GNUNET_free (value_name); 140 GNUNET_free (value_name);
141 141
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c
index e5c244081..5217638c5 100644
--- a/src/transport/test_transport_api_unreliability_constant.c
+++ b/src/transport/test_transport_api_unreliability_constant.c
@@ -122,16 +122,15 @@ static void
122end () 122end ()
123{ 123{
124 unsigned long long delta; 124 unsigned long long delta;
125
126 char *value_name; 125 char *value_name;
127 126
128 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); 127 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
129 128
130 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; 129 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
131 FPRINTF (stderr, "\nThroughput was %llu kb/s\n", 130 FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
132 total_bytes * 1000 / 1024 / delta); 131 total_bytes / 1024 / delta);
133 GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin); 132 GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin);
134 GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), 133 GAUGER ("TRANSPORT", value_name, (int) (total_bytes / 1024 / delta),
135 "kb/s"); 134 "kb/s");
136 GNUNET_free (value_name); 135 GNUNET_free (value_name);
137 136
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}