diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-10-27 10:04:42 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-10-27 10:04:42 +0000 |
commit | f47cc990ea9a89cb39acc9c6a9789e6474197708 (patch) | |
tree | f8301a2b5405ed692592fb98c94d53dc4a9c9151 /src/transport | |
parent | abcb868988fd2d754e13ef5122c8ada9c404b273 (diff) | |
download | gnunet-f47cc990ea9a89cb39acc9c6a9789e6474197708.tar.gz gnunet-f47cc990ea9a89cb39acc9c6a9789e6474197708.zip |
Refactoring gnunet time
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 44 | ||||
-rw-r--r-- | src/transport/plugin_transport_http.c | 24 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 8 | ||||
-rw-r--r-- | src/transport/test_quota_compliance.c | 91 | ||||
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api.c | 22 |
7 files changed, 126 insertions, 75 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 9d3e9d7c5..c1bb7bec6 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -1496,7 +1496,7 @@ find_ready_address(struct NeighbourList *neighbour) | |||
1496 | addresses = head->addresses; | 1496 | addresses = head->addresses; |
1497 | while (addresses != NULL) | 1497 | while (addresses != NULL) |
1498 | { | 1498 | { |
1499 | if ( (addresses->timeout.value < now.value) && | 1499 | if ( (addresses->timeout.abs_value < now.abs_value) && |
1500 | (addresses->connected == GNUNET_YES) ) | 1500 | (addresses->connected == GNUNET_YES) ) |
1501 | { | 1501 | { |
1502 | #if DEBUG_TRANSPORT | 1502 | #if DEBUG_TRANSPORT |
@@ -1528,7 +1528,7 @@ find_ready_address(struct NeighbourList *neighbour) | |||
1528 | addresses->in_transmit, | 1528 | addresses->in_transmit, |
1529 | addresses->validated, | 1529 | addresses->validated, |
1530 | addresses->connect_attempts, | 1530 | addresses->connect_attempts, |
1531 | (unsigned long long) addresses->timeout.value, | 1531 | (unsigned long long) addresses->timeout.abs_value, |
1532 | (unsigned int) addresses->distance); | 1532 | (unsigned int) addresses->distance); |
1533 | #endif | 1533 | #endif |
1534 | if ( ( (best_address == NULL) || | 1534 | if ( ( (best_address == NULL) || |
@@ -1536,7 +1536,7 @@ find_ready_address(struct NeighbourList *neighbour) | |||
1536 | (best_address->connected == GNUNET_NO) ) && | 1536 | (best_address->connected == GNUNET_NO) ) && |
1537 | (addresses->in_transmit == GNUNET_NO) && | 1537 | (addresses->in_transmit == GNUNET_NO) && |
1538 | ( (best_address == NULL) || | 1538 | ( (best_address == NULL) || |
1539 | (addresses->latency.value < best_address->latency.value)) ) | 1539 | (addresses->latency.rel_value < best_address->latency.rel_value)) ) |
1540 | best_address = addresses; | 1540 | best_address = addresses; |
1541 | /* FIXME: also give lower-latency addresses that are not | 1541 | /* FIXME: also give lower-latency addresses that are not |
1542 | connected a chance some times... */ | 1542 | connected a chance some times... */ |
@@ -1554,7 +1554,7 @@ find_ready_address(struct NeighbourList *neighbour) | |||
1554 | best_address->addr, | 1554 | best_address->addr, |
1555 | best_address->addrlen) | 1555 | best_address->addrlen) |
1556 | : "<inbound>", | 1556 | : "<inbound>", |
1557 | best_address->latency.value); | 1557 | best_address->latency.abs_value); |
1558 | #endif | 1558 | #endif |
1559 | } | 1559 | } |
1560 | else | 1560 | else |
@@ -1627,7 +1627,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1627 | 1, | 1627 | 1, |
1628 | GNUNET_NO); | 1628 | GNUNET_NO); |
1629 | timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); | 1629 | timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); |
1630 | if (timeout.value == 0) | 1630 | if (timeout.rel_value == 0) |
1631 | { | 1631 | { |
1632 | #if DEBUG_TRANSPORT | 1632 | #if DEBUG_TRANSPORT |
1633 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1633 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1667,7 +1667,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1667 | "No validated destination address available to transmit message of size %u to peer `%4s', will wait %llums to find an address.\n", | 1667 | "No validated destination address available to transmit message of size %u to peer `%4s', will wait %llums to find an address.\n", |
1668 | mq->message_buf_size, | 1668 | mq->message_buf_size, |
1669 | GNUNET_i2s (&mq->neighbour_id), | 1669 | GNUNET_i2s (&mq->neighbour_id), |
1670 | timeout.value); | 1670 | timeout.abs_value); |
1671 | #endif | 1671 | #endif |
1672 | /* FIXME: might want to trigger peerinfo lookup here | 1672 | /* FIXME: might want to trigger peerinfo lookup here |
1673 | (unless that's already pending...) */ | 1673 | (unless that's already pending...) */ |
@@ -1928,13 +1928,13 @@ update_addresses (struct TransportPlugin *plugin, int fresh) | |||
1928 | plugin->address_update_task = GNUNET_SCHEDULER_NO_TASK; | 1928 | plugin->address_update_task = GNUNET_SCHEDULER_NO_TASK; |
1929 | now = GNUNET_TIME_absolute_get (); | 1929 | now = GNUNET_TIME_absolute_get (); |
1930 | min_remaining = GNUNET_TIME_UNIT_FOREVER_REL; | 1930 | min_remaining = GNUNET_TIME_UNIT_FOREVER_REL; |
1931 | expired = (GNUNET_TIME_absolute_get_duration (last_update).value > (HELLO_ADDRESS_EXPIRATION.value / 4)); | 1931 | expired = (GNUNET_TIME_absolute_get_duration (last_update).rel_value > (HELLO_ADDRESS_EXPIRATION.rel_value / 4)); |
1932 | prev = NULL; | 1932 | prev = NULL; |
1933 | pos = plugin->addresses; | 1933 | pos = plugin->addresses; |
1934 | while (pos != NULL) | 1934 | while (pos != NULL) |
1935 | { | 1935 | { |
1936 | next = pos->next; | 1936 | next = pos->next; |
1937 | if (pos->expires.value < now.value) | 1937 | if (pos->expires.abs_value < now.abs_value) |
1938 | { | 1938 | { |
1939 | expired = GNUNET_YES; | 1939 | expired = GNUNET_YES; |
1940 | if (prev == NULL) | 1940 | if (prev == NULL) |
@@ -1946,7 +1946,7 @@ update_addresses (struct TransportPlugin *plugin, int fresh) | |||
1946 | else | 1946 | else |
1947 | { | 1947 | { |
1948 | remaining = GNUNET_TIME_absolute_get_remaining (pos->expires); | 1948 | remaining = GNUNET_TIME_absolute_get_remaining (pos->expires); |
1949 | if (remaining.value < min_remaining.value) | 1949 | if (remaining.rel_value < min_remaining.rel_value) |
1950 | min_remaining = remaining; | 1950 | min_remaining = remaining; |
1951 | prev = pos; | 1951 | prev = pos; |
1952 | } | 1952 | } |
@@ -2191,7 +2191,7 @@ plugin_env_notify_address (void *cls, | |||
2191 | { | 2191 | { |
2192 | if ((addrlen == al->addrlen) && (0 == memcmp (addr, &al[1], addrlen))) | 2192 | if ((addrlen == al->addrlen) && (0 == memcmp (addr, &al[1], addrlen))) |
2193 | { | 2193 | { |
2194 | if (al->expires.value < abex.value) | 2194 | if (al->expires.abs_value < abex.abs_value) |
2195 | al->expires = abex; | 2195 | al->expires = abex; |
2196 | return; | 2196 | return; |
2197 | } | 2197 | } |
@@ -2631,7 +2631,7 @@ add_to_foreign_address_list (void *cls, | |||
2631 | a2s (tname, addr, addrlen), | 2631 | a2s (tname, addr, addrlen), |
2632 | tname, | 2632 | tname, |
2633 | GNUNET_i2s (&n->id), | 2633 | GNUNET_i2s (&n->id), |
2634 | expiration.value); | 2634 | expiration.abs_value); |
2635 | #endif | 2635 | #endif |
2636 | fal = add_peer_address (n, tname, NULL, addr, addrlen); | 2636 | fal = add_peer_address (n, tname, NULL, addr, addrlen); |
2637 | if (fal == NULL) | 2637 | if (fal == NULL) |
@@ -3364,7 +3364,7 @@ schedule_next_ping (struct ForeignAddressList *fal) | |||
3364 | if (fal->revalidate_task != GNUNET_SCHEDULER_NO_TASK) | 3364 | if (fal->revalidate_task != GNUNET_SCHEDULER_NO_TASK) |
3365 | return; | 3365 | return; |
3366 | delay = GNUNET_TIME_absolute_get_remaining (fal->expires); | 3366 | delay = GNUNET_TIME_absolute_get_remaining (fal->expires); |
3367 | delay.value /= 2; /* do before expiration */ | 3367 | delay.rel_value /= 2; /* do before expiration */ |
3368 | delay = GNUNET_TIME_relative_min (delay, | 3368 | delay = GNUNET_TIME_relative_min (delay, |
3369 | LATENCY_EVALUATION_MAX_DELAY); | 3369 | LATENCY_EVALUATION_MAX_DELAY); |
3370 | if (GNUNET_YES != fal->estimated) | 3370 | if (GNUNET_YES != fal->estimated) |
@@ -3383,7 +3383,7 @@ schedule_next_ping (struct ForeignAddressList *fal) | |||
3383 | delay = GNUNET_TIME_relative_max (delay, | 3383 | delay = GNUNET_TIME_relative_max (delay, |
3384 | GNUNET_TIME_UNIT_SECONDS); | 3384 | GNUNET_TIME_UNIT_SECONDS); |
3385 | /* randomize a bit (to avoid doing all at the same time) */ | 3385 | /* randomize a bit (to avoid doing all at the same time) */ |
3386 | delay.value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); | 3386 | delay.rel_value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); |
3387 | fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched, | 3387 | fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched, |
3388 | delay, | 3388 | delay, |
3389 | &send_periodic_ping, | 3389 | &send_periodic_ping, |
@@ -3627,7 +3627,7 @@ check_pending_validation (void *cls, | |||
3627 | GNUNET_break_op (0); | 3627 | GNUNET_break_op (0); |
3628 | return GNUNET_NO; | 3628 | return GNUNET_NO; |
3629 | } | 3629 | } |
3630 | if (GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (pong->expiration)).value == 0) | 3630 | if (GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value == 0) |
3631 | { | 3631 | { |
3632 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 3632 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
3633 | _("Received expired signature. Check system time.\n")); | 3633 | _("Received expired signature. Check system time.\n")); |
@@ -3672,10 +3672,10 @@ check_pending_validation (void *cls, | |||
3672 | GNUNET_NO); | 3672 | GNUNET_NO); |
3673 | fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); | 3673 | fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); |
3674 | schedule_next_ping (fal); | 3674 | schedule_next_ping (fal); |
3675 | if (n->latency.value == GNUNET_TIME_UNIT_FOREVER_REL.value) | 3675 | if (n->latency.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) |
3676 | n->latency = fal->latency; | 3676 | n->latency = fal->latency; |
3677 | else | 3677 | else |
3678 | n->latency.value = (fal->latency.value + n->latency.value) / 2; | 3678 | n->latency.rel_value = (fal->latency.rel_value + n->latency.rel_value) / 2; |
3679 | 3679 | ||
3680 | n->distance = fal->distance; | 3680 | n->distance = fal->distance; |
3681 | if (GNUNET_NO == n->received_pong) | 3681 | if (GNUNET_NO == n->received_pong) |
@@ -4200,7 +4200,7 @@ process_hello (struct TransportPlugin *plugin, | |||
4200 | { | 4200 | { |
4201 | if (GNUNET_HELLO_equals (hello, | 4201 | if (GNUNET_HELLO_equals (hello, |
4202 | chvc->hello, | 4202 | chvc->hello, |
4203 | GNUNET_TIME_absolute_get ()).value > 0) | 4203 | GNUNET_TIME_absolute_get ()).abs_value > 0) |
4204 | { | 4204 | { |
4205 | #if DEBUG_TRANSPORT_HELLO > 2 | 4205 | #if DEBUG_TRANSPORT_HELLO > 2 |
4206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -4500,7 +4500,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4500 | memcpy (&((char*)&pong[1])[slen], | 4500 | memcpy (&((char*)&pong[1])[slen], |
4501 | sender_address, | 4501 | sender_address, |
4502 | sender_address_len); | 4502 | sender_address_len); |
4503 | if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires).value < PONG_SIGNATURE_LIFETIME.value / 4) | 4503 | if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires).rel_value < PONG_SIGNATURE_LIFETIME.rel_value / 4) |
4504 | { | 4504 | { |
4505 | /* create / update cached sig */ | 4505 | /* create / update cached sig */ |
4506 | #if DEBUG_TRANSPORT | 4506 | #if DEBUG_TRANSPORT |
@@ -4568,7 +4568,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4568 | memcpy (&pong[1], plugin->short_name, slen); | 4568 | memcpy (&pong[1], plugin->short_name, slen); |
4569 | memcpy (&((char*)&pong[1])[slen], addr, alen); | 4569 | memcpy (&((char*)&pong[1])[slen], addr, alen); |
4570 | if ( (oal != NULL) && | 4570 | if ( (oal != NULL) && |
4571 | (GNUNET_TIME_absolute_get_remaining (oal->pong_sig_expires).value < PONG_SIGNATURE_LIFETIME.value / 4) ) | 4571 | (GNUNET_TIME_absolute_get_remaining (oal->pong_sig_expires).rel_value < PONG_SIGNATURE_LIFETIME.rel_value / 4) ) |
4572 | { | 4572 | { |
4573 | /* create / update cached sig */ | 4573 | /* create / update cached sig */ |
4574 | #if DEBUG_TRANSPORT | 4574 | #if DEBUG_TRANSPORT |
@@ -4786,16 +4786,16 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4786 | } | 4786 | } |
4787 | } | 4787 | } |
4788 | ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0); | 4788 | ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0); |
4789 | if (ret.value > 0) | 4789 | if (ret.rel_value > 0) |
4790 | { | 4790 | { |
4791 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4791 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4792 | "Throttling read (%llu bytes excess at %u b/s), waiting %llums before reading more.\n", | 4792 | "Throttling read (%llu bytes excess at %u b/s), waiting %llums before reading more.\n", |
4793 | (unsigned long long) n->in_tracker.consumption_since_last_update__, | 4793 | (unsigned long long) n->in_tracker.consumption_since_last_update__, |
4794 | (unsigned int) n->in_tracker.available_bytes_per_s__, | 4794 | (unsigned int) n->in_tracker.available_bytes_per_s__, |
4795 | (unsigned long long) ret.value); | 4795 | (unsigned long long) ret.rel_value); |
4796 | GNUNET_STATISTICS_update (stats, | 4796 | GNUNET_STATISTICS_update (stats, |
4797 | gettext_noop ("# ms throttling suggested"), | 4797 | gettext_noop ("# ms throttling suggested"), |
4798 | (int64_t) ret.value, | 4798 | (int64_t) ret.rel_value, |
4799 | GNUNET_NO); | 4799 | GNUNET_NO); |
4800 | } | 4800 | } |
4801 | return ret; | 4801 | return ret; |
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index ac04610c1..e4c88903f 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -882,10 +882,10 @@ static void mhd_write_mst_cb (void *cls, | |||
882 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) | 882 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) |
883 | GNUNET_SCHEDULER_cancel (pc->plugin->env->sched, pc->reset_task); | 883 | GNUNET_SCHEDULER_cancel (pc->plugin->env->sched, pc->reset_task); |
884 | 884 | ||
885 | if (delay.value > 0) | 885 | if (delay.rel_value > 0) |
886 | { | 886 | { |
887 | #if DEBUG_HTTP | 887 | #if DEBUG_HTTP |
888 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.value); | 888 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.rel_value); |
889 | #endif | 889 | #endif |
890 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (pc->plugin->env->sched, delay, &reset_inbound_quota_delay, pc); | 890 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (pc->plugin->env->sched, delay, &reset_inbound_quota_delay, pc); |
891 | } | 891 | } |
@@ -1182,7 +1182,7 @@ mhd_access_cb (void *cls, | |||
1182 | /* Recieving data */ | 1182 | /* Recieving data */ |
1183 | if ((*upload_data_size > 0) && (ps->recv_active == GNUNET_YES)) | 1183 | if ((*upload_data_size > 0) && (ps->recv_active == GNUNET_YES)) |
1184 | { | 1184 | { |
1185 | if (pc->delay.value == 0) | 1185 | if (pc->delay.rel_value == 0) |
1186 | { | 1186 | { |
1187 | #if DEBUG_HTTP | 1187 | #if DEBUG_HTTP |
1188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: PUT with %u bytes forwarded to MST\n", ps, *upload_data_size); | 1188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: PUT with %u bytes forwarded to MST\n", ps, *upload_data_size); |
@@ -1193,7 +1193,7 @@ mhd_access_cb (void *cls, | |||
1193 | else | 1193 | else |
1194 | { | 1194 | { |
1195 | #if DEBUG_HTTP | 1195 | #if DEBUG_HTTP |
1196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: no inbound bandwidth available! Next read was delayed for %llu ms\n", ps, ps->peercontext->delay.value); | 1196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: no inbound bandwidth available! Next read was delayed for %llu ms\n", ps, ps->peercontext->delay.rel_value); |
1197 | #endif | 1197 | #endif |
1198 | } | 1198 | } |
1199 | return MHD_YES; | 1199 | return MHD_YES; |
@@ -1264,7 +1264,7 @@ http_server_daemon_prepare (struct Plugin *plugin , struct MHD_Daemon *daemon_ha | |||
1264 | &max)); | 1264 | &max)); |
1265 | haveto = MHD_get_timeout (daemon_handle, &timeout); | 1265 | haveto = MHD_get_timeout (daemon_handle, &timeout); |
1266 | if (haveto == MHD_YES) | 1266 | if (haveto == MHD_YES) |
1267 | tv.value = (uint64_t) timeout; | 1267 | tv.rel_value = (uint64_t) timeout; |
1268 | else | 1268 | else |
1269 | tv = GNUNET_TIME_UNIT_SECONDS; | 1269 | tv = GNUNET_TIME_UNIT_SECONDS; |
1270 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); | 1270 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); |
@@ -1588,10 +1588,10 @@ static void curl_receive_mst_cb (void *cls, | |||
1588 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) | 1588 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) |
1589 | GNUNET_SCHEDULER_cancel (pc->plugin->env->sched, pc->reset_task); | 1589 | GNUNET_SCHEDULER_cancel (pc->plugin->env->sched, pc->reset_task); |
1590 | 1590 | ||
1591 | if (delay.value > 0) | 1591 | if (delay.rel_value > 0) |
1592 | { | 1592 | { |
1593 | #if DEBUG_HTTP | 1593 | #if DEBUG_HTTP |
1594 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.value); | 1594 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.abs_value); |
1595 | #endif | 1595 | #endif |
1596 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (pc->plugin->env->sched, delay, &reset_inbound_quota_delay, pc); | 1596 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (pc->plugin->env->sched, delay, &reset_inbound_quota_delay, pc); |
1597 | } | 1597 | } |
@@ -1611,10 +1611,10 @@ static size_t curl_receive_cb( void *stream, size_t size, size_t nmemb, void *pt | |||
1611 | { | 1611 | { |
1612 | struct Session * ps = ptr; | 1612 | struct Session * ps = ptr; |
1613 | 1613 | ||
1614 | if (ps->peercontext->delay.value > 0) | 1614 | if (ps->peercontext->delay.rel_value > 0) |
1615 | { | 1615 | { |
1616 | #if DEBUG_HTTP | 1616 | #if DEBUG_HTTP |
1617 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: no inbound bandwidth available! Next read was delayed for %llu ms\n", ps, ps->peercontext->delay.value); | 1617 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: no inbound bandwidth available! Next read was delayed for %llu ms\n", ps, ps->peercontext->delay.rel_value); |
1618 | #endif | 1618 | #endif |
1619 | return (0); | 1619 | return (0); |
1620 | } | 1620 | } |
@@ -1935,7 +1935,7 @@ static int send_check_connections (struct Plugin *plugin, struct Session *ps) | |||
1935 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_READDATA, ps); | 1935 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_READDATA, ps); |
1936 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_WRITEFUNCTION, curl_receive_cb); | 1936 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_WRITEFUNCTION, curl_receive_cb); |
1937 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_WRITEDATA, ps); | 1937 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_WRITEDATA, ps); |
1938 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_TIMEOUT, (long) timeout.value); | 1938 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_TIMEOUT, (long) timeout.rel_value); |
1939 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps); | 1939 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_PRIVATE, ps); |
1940 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); | 1940 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); |
1941 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, 2*GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1941 | curl_easy_setopt(ps->recv_endpoint, CURLOPT_BUFFERSIZE, 2*GNUNET_SERVER_MAX_MESSAGE_SIZE); |
@@ -2034,7 +2034,7 @@ static int send_check_connections (struct Plugin *plugin, struct Session *ps) | |||
2034 | curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps); | 2034 | curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps); |
2035 | curl_easy_setopt(ps->send_endpoint, CURLOPT_WRITEFUNCTION, curl_receive_cb); | 2035 | curl_easy_setopt(ps->send_endpoint, CURLOPT_WRITEFUNCTION, curl_receive_cb); |
2036 | curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps); | 2036 | curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps); |
2037 | curl_easy_setopt(ps->send_endpoint, CURLOPT_TIMEOUT, (long) timeout.value); | 2037 | curl_easy_setopt(ps->send_endpoint, CURLOPT_TIMEOUT, (long) timeout.rel_value); |
2038 | curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps); | 2038 | curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps); |
2039 | curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); | 2039 | curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, HTTP_CONNECT_TIMEOUT); |
2040 | curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); | 2040 | curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); |
@@ -2982,7 +2982,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
2982 | GNUNET_assert ((port > 0) && (port <= 65535)); | 2982 | GNUNET_assert ((port > 0) && (port <= 65535)); |
2983 | plugin->port_inbound = port; | 2983 | plugin->port_inbound = port; |
2984 | gn_timeout = GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT; | 2984 | gn_timeout = GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT; |
2985 | unsigned int timeout = (gn_timeout.value) / 1000; | 2985 | unsigned int timeout = (gn_timeout.rel_value) / 1000; |
2986 | if ((plugin->http_server_daemon_v6 == NULL) && (plugin->use_ipv6 == GNUNET_YES) && (port != 0)) | 2986 | if ((plugin->http_server_daemon_v6 == NULL) && (plugin->use_ipv6 == GNUNET_YES) && (port != 0)) |
2987 | { | 2987 | { |
2988 | struct sockaddr * tmp = (struct sockaddr *) plugin->bind6_address; | 2988 | struct sockaddr * tmp = (struct sockaddr *) plugin->bind6_address; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index bf14092fb..7ac31ecb6 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -697,7 +697,7 @@ do_transmit (void *cls, size_t size, void *buf) | |||
697 | ret = 0; | 697 | ret = 0; |
698 | now = GNUNET_TIME_absolute_get (); | 698 | now = GNUNET_TIME_absolute_get (); |
699 | while ( (NULL != (pos = session->pending_messages_head)) && | 699 | while ( (NULL != (pos = session->pending_messages_head)) && |
700 | (pos->timeout.value <= now.value) ) | 700 | (pos->timeout.abs_value <= now.abs_value) ) |
701 | { | 701 | { |
702 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | 702 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, |
703 | session->pending_messages_tail, | 703 | session->pending_messages_tail, |
@@ -930,9 +930,9 @@ select_better_session (struct Session *s1, | |||
930 | if ( (s1->expecting_welcome == GNUNET_YES) && | 930 | if ( (s1->expecting_welcome == GNUNET_YES) && |
931 | (s2->expecting_welcome == GNUNET_NO) ) | 931 | (s2->expecting_welcome == GNUNET_NO) ) |
932 | return s2; | 932 | return s2; |
933 | if (s1->last_activity.value < s2->last_activity.value) | 933 | if (s1->last_activity.abs_value < s2->last_activity.abs_value) |
934 | return s2; | 934 | return s2; |
935 | if (s1->last_activity.value > s2->last_activity.value) | 935 | if (s1->last_activity.abs_value > s2->last_activity.abs_value) |
936 | return s1; | 936 | return s1; |
937 | if ( (GNUNET_YES == s1->inbound) && | 937 | if ( (GNUNET_YES == s1->inbound) && |
938 | (GNUNET_NO == s2->inbound) ) | 938 | (GNUNET_NO == s2->inbound) ) |
@@ -1806,7 +1806,7 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1806 | NULL, 0, | 1806 | NULL, 0, |
1807 | session, | 1807 | session, |
1808 | NULL, 0); | 1808 | NULL, 0); |
1809 | if (delay.value == 0) | 1809 | if (delay.rel_value == 0) |
1810 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); | 1810 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); |
1811 | else | 1811 | else |
1812 | session->receive_delay_task = | 1812 | session->receive_delay_task = |
@@ -1860,7 +1860,7 @@ handle_tcp_data (void *cls, | |||
1860 | session, | 1860 | session, |
1861 | (GNUNET_YES == session->inbound) ? NULL : session->connect_addr, | 1861 | (GNUNET_YES == session->inbound) ? NULL : session->connect_addr, |
1862 | (GNUNET_YES == session->inbound) ? 0 : session->connect_alen); | 1862 | (GNUNET_YES == session->inbound) ? 0 : session->connect_alen); |
1863 | if (delay.value == 0) | 1863 | if (delay.rel_value == 0) |
1864 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1864 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1865 | else | 1865 | else |
1866 | session->receive_delay_task = | 1866 | session->receive_delay_task = |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 765d8721d..54cc3f864 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -565,7 +565,7 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
565 | struct GNUNET_TIME_Relative timeout; | 565 | struct GNUNET_TIME_Relative timeout; |
566 | struct Sessionqueue * nextsession = NULL; | 566 | struct Sessionqueue * nextsession = NULL; |
567 | 567 | ||
568 | timeout.value = FRAGMENT_TIMEOUT; | 568 | timeout.rel_value = FRAGMENT_TIMEOUT; |
569 | nextsend = GNUNET_TIME_absolute_get_forever(); | 569 | nextsend = GNUNET_TIME_absolute_get_forever(); |
570 | 570 | ||
571 | queue = plugin->pending_Sessions; | 571 | queue = plugin->pending_Sessions; |
@@ -596,7 +596,7 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
596 | //save next session | 596 | //save next session |
597 | nextsession = queue->next; | 597 | nextsession = queue->next; |
598 | // test if message timed out | 598 | // test if message timed out |
599 | while (GNUNET_TIME_absolute_get_remaining(pm->timeout).value == 0){ | 599 | while (GNUNET_TIME_absolute_get_remaining(pm->timeout).rel_value == 0){ |
600 | //remove message | 600 | //remove message |
601 | //free the acks | 601 | //free the acks |
602 | free_acks (pm); | 602 | free_acks (pm); |
@@ -637,7 +637,7 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
637 | nextsession = NULL; | 637 | nextsession = NULL; |
638 | 638 | ||
639 | // test if retransmit is needed | 639 | // test if retransmit is needed |
640 | if (GNUNET_TIME_absolute_get_duration(pm->last_ack).value < FRAGMENT_TIMEOUT) { | 640 | if (GNUNET_TIME_absolute_get_duration(pm->last_ack).rel_value < FRAGMENT_TIMEOUT) { |
641 | // get last offset for this message | 641 | // get last offset for this message |
642 | copyoffset = pm->message_size /(WLAN_MTU - sizeof(struct FragmentationHeader)); | 642 | copyoffset = pm->message_size /(WLAN_MTU - sizeof(struct FragmentationHeader)); |
643 | // one more is the end | 643 | // one more is the end |
@@ -693,7 +693,7 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
693 | if (pm->message_size > WLAN_MTU) { | 693 | if (pm->message_size > WLAN_MTU) { |
694 | size += sizeof(struct FragmentationHeader); | 694 | size += sizeof(struct FragmentationHeader); |
695 | // check for retransmission | 695 | // check for retransmission |
696 | if (GNUNET_TIME_absolute_get_duration(pm->last_ack).value > FRAGMENT_TIMEOUT) { | 696 | if (GNUNET_TIME_absolute_get_duration(pm->last_ack).rel_value > FRAGMENT_TIMEOUT) { |
697 | // TODO retransmit | 697 | // TODO retransmit |
698 | // be positive and try again later :-D | 698 | // be positive and try again later :-D |
699 | pm->last_ack = GNUNET_TIME_absolute_get(); | 699 | pm->last_ack = GNUNET_TIME_absolute_get(); |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 018324a4e..a5a836d48 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -49,18 +49,20 @@ | |||
49 | */ | 49 | */ |
50 | #define TOTAL_MSGS (10000 * 2) | 50 | #define TOTAL_MSGS (10000 * 2) |
51 | 51 | ||
52 | #define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) | 52 | #define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
53 | #define MEASUREMENT_MSG_SIZE 1024 | 53 | #define MEASUREMENT_MSG_SIZE 10000 |
54 | #define MEASUREMENT_MSG_SIZE_BIG 32768 | 54 | #define MEASUREMENT_MSG_SIZE_BIG 32768 |
55 | #define MEASUREMENT_MAX_QUOTA 1024*1024*1024 | 55 | #define MEASUREMENT_MAX_QUOTA 50000 |
56 | #define MEASUREMENT_MIN_QUOTA 1024 | 56 | /*#define MEASUREMENT_MAX_QUOTA 1000000*/ |
57 | 57 | #define MEASUREMENT_MIN_QUOTA 1000 | |
58 | #define SEND_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | ||
58 | /** | 59 | /** |
59 | * Testcase timeout | 60 | * Testcase timeout |
60 | */ | 61 | */ |
61 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 200) | 62 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 200) |
62 | 63 | ||
63 | 64 | ||
65 | |||
64 | #define MTYPE 11111 | 66 | #define MTYPE 11111 |
65 | 67 | ||
66 | struct PeerContext | 68 | struct PeerContext |
@@ -73,6 +75,54 @@ struct PeerContext | |||
73 | #endif | 75 | #endif |
74 | }; | 76 | }; |
75 | 77 | ||
78 | /** | ||
79 | * Handle for a transmission-ready request. | ||
80 | */ | ||
81 | struct GNUNET_TRANSPORT_TransmitHandle | ||
82 | { | ||
83 | |||
84 | /** | ||
85 | * Neighbour for this handle, NULL for control-traffic. | ||
86 | */ | ||
87 | struct NeighbourList *neighbour; | ||
88 | |||
89 | /** | ||
90 | * Function to call when notify_size bytes are available | ||
91 | * for transmission. | ||
92 | */ | ||
93 | GNUNET_CONNECTION_TransmitReadyNotify notify; | ||
94 | |||
95 | /** | ||
96 | * Closure for notify. | ||
97 | */ | ||
98 | void *notify_cls; | ||
99 | |||
100 | /** | ||
101 | * transmit_ready task Id. The task is used to introduce the | ||
102 | * artificial delay that may be required to maintain the bandwidth | ||
103 | * limits. Later, this will be the ID of the "transmit_timeout" | ||
104 | * task which is used to signal a timeout if the transmission could | ||
105 | * not be done in a timely fashion. | ||
106 | */ | ||
107 | GNUNET_SCHEDULER_TaskIdentifier notify_delay_task; | ||
108 | |||
109 | /** | ||
110 | * Timeout for this request. | ||
111 | */ | ||
112 | struct GNUNET_TIME_Absolute timeout; | ||
113 | |||
114 | /** | ||
115 | * How many bytes is our notify callback waiting for? | ||
116 | */ | ||
117 | size_t notify_size; | ||
118 | |||
119 | /** | ||
120 | * How important is this message? | ||
121 | */ | ||
122 | unsigned int priority; | ||
123 | |||
124 | }; | ||
125 | |||
76 | static struct PeerContext p1; | 126 | static struct PeerContext p1; |
77 | 127 | ||
78 | static struct PeerContext p2; | 128 | static struct PeerContext p2; |
@@ -177,7 +227,7 @@ struct TestMessage | |||
177 | }; | 227 | }; |
178 | 228 | ||
179 | static unsigned int | 229 | static unsigned int |
180 | get_size_new (unsigned int iter) | 230 | get_size (unsigned int iter) |
181 | { | 231 | { |
182 | return MEASUREMENT_MSG_SIZE + sizeof (struct TestMessage); | 232 | return MEASUREMENT_MSG_SIZE + sizeof (struct TestMessage); |
183 | } | 233 | } |
@@ -194,7 +244,7 @@ notify_receive_new (void *cls, | |||
194 | const struct TestMessage *hdr; | 244 | const struct TestMessage *hdr; |
195 | 245 | ||
196 | hdr = (const struct TestMessage*) message; | 246 | hdr = (const struct TestMessage*) message; |
197 | s = get_size_new (n); | 247 | s = get_size (n); |
198 | if (MTYPE != ntohs (message->type)) | 248 | if (MTYPE != ntohs (message->type)) |
199 | return; | 249 | return; |
200 | #if DEBUG_MEASUREMENT | 250 | #if DEBUG_MEASUREMENT |
@@ -234,7 +284,7 @@ notify_ready_new (void *cls, size_t size, void *buf) | |||
234 | return 0; | 284 | return 0; |
235 | 285 | ||
236 | ret = 0; | 286 | ret = 0; |
237 | s = get_size_new (n); | 287 | s = get_size (n); |
238 | GNUNET_assert (size >= s); | 288 | GNUNET_assert (size >= s); |
239 | GNUNET_assert (buf != NULL); | 289 | GNUNET_assert (buf != NULL); |
240 | cbuf = buf; | 290 | cbuf = buf; |
@@ -255,14 +305,14 @@ notify_ready_new (void *cls, size_t size, void *buf) | |||
255 | } | 305 | } |
256 | #endif | 306 | #endif |
257 | n++; | 307 | n++; |
258 | s = get_size_new (n); | 308 | s = get_size (n); |
259 | if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16)) | 309 | if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16)) |
260 | break; /* sometimes pack buffer full, sometimes not */ | 310 | break; /* sometimes pack buffer full, sometimes not */ |
261 | } | 311 | } |
262 | while (size - ret >= s); | 312 | while (size - ret >= s); |
263 | transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th, | 313 | transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th, |
264 | &p1.id, | 314 | &p1.id, |
265 | s, 0, TIMEOUT, | 315 | s, 0, SEND_TIMEOUT, |
266 | ¬ify_ready_new, | 316 | ¬ify_ready_new, |
267 | NULL); | 317 | NULL); |
268 | total_bytes += s; | 318 | total_bytes += s; |
@@ -313,14 +363,14 @@ measurement_end (void *cls, | |||
313 | GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle); | 363 | GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle); |
314 | transmit_handle = NULL; | 364 | transmit_handle = NULL; |
315 | } | 365 | } |
316 | if (current_quota_p1 < total_bytes/(duration.value / 1000)) | 366 | if ((total_bytes/(duration.rel_value / 1000)) > (current_quota_p1 + (current_quota_p1 / 10))) |
317 | { | 367 | { |
318 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 368 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
319 | "\nQuota compliance failed: \n"\ | 369 | "\nQuota compliance failed: \n"\ |
320 | "Quota allowed: %10llu kb/s\n"\ | 370 | "Quota allowed: %10llu kB/s\n"\ |
321 | "Throughput : %10llu kb/s\n", (current_quota_p1 / (1024)) , (total_bytes/(duration.value / 1000)/1024)); | 371 | "Throughput : %10llu kB/s\n", (current_quota_p1 / (1024)) , (total_bytes/(duration.rel_value / 1000)/1024)); |
322 | ok = 1; | 372 | ok = 1; |
323 | end(); | 373 | //end(); |
324 | return; | 374 | return; |
325 | } | 375 | } |
326 | else | 376 | else |
@@ -328,14 +378,15 @@ measurement_end (void *cls, | |||
328 | 378 | ||
329 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 379 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
330 | "\nQuota compliance ok: \n"\ | 380 | "\nQuota compliance ok: \n"\ |
331 | "Quota allowed: %10llu kb/s\n"\ | 381 | "Quota allowed: %10llu kB/s\n"\ |
332 | "Throughput : %10llu kb/s\n", (current_quota_p1 / (1024)) , (total_bytes/(duration.value / 1000)/1024)); | 382 | "Throughput : %10llu kB/s\n", (current_quota_p1 / (1024)) , (total_bytes/(duration.rel_value / 1000)/1024)); |
333 | ok = 0; | 383 | ok = 0; |
334 | } | 384 | } |
335 | if (current_quota_p1 < (MEASUREMENT_MIN_QUOTA)) | 385 | if (current_quota_p1 < MEASUREMENT_MIN_QUOTA) |
336 | end(); | 386 | end(); |
337 | else | 387 | else |
338 | measure (current_quota_p1/100, current_quota_p2/100); | 388 | |
389 | measure (current_quota_p1- 1000, current_quota_p2- 1000); | ||
339 | } | 390 | } |
340 | 391 | ||
341 | static void measure (unsigned long long quota_p1, unsigned long long quota_p2 ) | 392 | static void measure (unsigned long long quota_p1, unsigned long long quota_p2 ) |
@@ -344,7 +395,7 @@ static void measure (unsigned long long quota_p1, unsigned long long quota_p2 ) | |||
344 | current_quota_p2 = quota_p2; | 395 | current_quota_p2 = quota_p2; |
345 | #if VERBOSE | 396 | #if VERBOSE |
346 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
347 | "Starting transport level measurement: Duration: %u Quota: %u\n", MEASUREMENT_INTERVALL, current_quota_p1); | 398 | "Starting transport level measurement: Duration: %u Quota: %llu\n", MEASUREMENT_INTERVALL, current_quota_p1); |
348 | #endif | 399 | #endif |
349 | GNUNET_TRANSPORT_set_quota (p1.th, | 400 | GNUNET_TRANSPORT_set_quota (p1.th, |
350 | &p2.id, | 401 | &p2.id, |
@@ -383,7 +434,7 @@ static void measure (unsigned long long quota_p1, unsigned long long quota_p2 ) | |||
383 | 434 | ||
384 | transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th, | 435 | transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th, |
385 | &p1.id, | 436 | &p1.id, |
386 | get_size_new (0), 0, TIMEOUT, | 437 | get_size (0), 0, SEND_TIMEOUT, |
387 | ¬ify_ready_new, | 438 | ¬ify_ready_new, |
388 | NULL); | 439 | NULL); |
389 | } | 440 | } |
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 1f0fcfd3c..0625230a4 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -127,7 +127,7 @@ end () | |||
127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
128 | "Transports disconnected, returning success!\n"); | 128 | "Transports disconnected, returning success!\n"); |
129 | #endif | 129 | #endif |
130 | delta = GNUNET_TIME_absolute_get_duration (start_time).value; | 130 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; |
131 | fprintf (stderr, | 131 | fprintf (stderr, |
132 | "\nThroughput was %llu kb/s\n", | 132 | "\nThroughput was %llu kb/s\n", |
133 | total_bytes * 1000 / 1024 / delta); | 133 | total_bytes * 1000 / 1024 / delta); |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index f1c065780..53330d39e 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -465,13 +465,13 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
465 | duration = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, | 465 | duration = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, |
466 | th->notify_size - sizeof (struct OutboundMessage)); | 466 | th->notify_size - sizeof (struct OutboundMessage)); |
467 | struct GNUNET_TIME_Absolute duration_abs = GNUNET_TIME_relative_to_absolute (duration); | 467 | struct GNUNET_TIME_Absolute duration_abs = GNUNET_TIME_relative_to_absolute (duration); |
468 | if (th->timeout.value < duration_abs.value) | 468 | if (th->timeout.abs_value < duration_abs.abs_value) |
469 | { | 469 | { |
470 | /* signal timeout! */ | 470 | /* signal timeout! */ |
471 | #if DEBUG_TRANSPORT | 471 | #if DEBUG_TRANSPORT |
472 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 472 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
473 | "Would need %llu ms before bandwidth is available for delivery to `%4s', that is too long. Signaling timeout.\n", | 473 | "Would need %llu ms before bandwidth is available for delivery to `%4s', that is too long. Signaling timeout.\n", |
474 | duration.value, | 474 | duration.abs_value, |
475 | GNUNET_i2s (&n->id)); | 475 | GNUNET_i2s (&n->id)); |
476 | #endif | 476 | #endif |
477 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 477 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -484,7 +484,7 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
484 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); | 484 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); |
485 | continue; | 485 | continue; |
486 | } | 486 | } |
487 | if (duration.value > 0) | 487 | if (duration.rel_value > 0) |
488 | { | 488 | { |
489 | #if DEBUG_TRANSPORT | 489 | #if DEBUG_TRANSPORT |
490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -492,7 +492,7 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
492 | (unsigned int) n->out_tracker.available_bytes_per_s__, | 492 | (unsigned int) n->out_tracker.available_bytes_per_s__, |
493 | (unsigned int) th->notify_size - sizeof (struct OutboundMessage), | 493 | (unsigned int) th->notify_size - sizeof (struct OutboundMessage), |
494 | GNUNET_i2s (&n->id), | 494 | GNUNET_i2s (&n->id), |
495 | duration.value); | 495 | duration.abs_value); |
496 | #endif | 496 | #endif |
497 | retry_time = GNUNET_TIME_relative_min (retry_time, | 497 | retry_time = GNUNET_TIME_relative_min (retry_time, |
498 | duration); | 498 | duration); |
@@ -608,7 +608,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
608 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 608 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
609 | "Message of %u bytes with timeout %llums constructed for `%4s'\n", | 609 | "Message of %u bytes with timeout %llums constructed for `%4s'\n", |
610 | (unsigned int) mret, | 610 | (unsigned int) mret, |
611 | (unsigned long long) GNUNET_TIME_absolute_get_remaining (th->timeout).value, | 611 | (unsigned long long) GNUNET_TIME_absolute_get_remaining (th->timeout).abs_value, |
612 | GNUNET_i2s (&n->id)); | 612 | GNUNET_i2s (&n->id)); |
613 | #endif | 613 | #endif |
614 | if (mret != 0) | 614 | if (mret != 0) |
@@ -755,7 +755,7 @@ schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, | |||
755 | #if DEBUG_TRANSPORT | 755 | #if DEBUG_TRANSPORT |
756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
757 | "Control transmit of %u bytes within %llums requested\n", | 757 | "Control transmit of %u bytes within %llums requested\n", |
758 | size, (unsigned long long) timeout.value); | 758 | size, (unsigned long long) timeout.abs_value); |
759 | #endif | 759 | #endif |
760 | th = GNUNET_malloc (sizeof (struct ControlMessage)); | 760 | th = GNUNET_malloc (sizeof (struct ControlMessage)); |
761 | th->h = h; | 761 | th->h = h; |
@@ -1235,14 +1235,14 @@ schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) | |||
1235 | #if DEBUG_TRANSPORT | 1235 | #if DEBUG_TRANSPORT |
1236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1237 | "Scheduling task to reconnect to transport service in %llu ms.\n", | 1237 | "Scheduling task to reconnect to transport service in %llu ms.\n", |
1238 | h->reconnect_delay.value); | 1238 | h->reconnect_delay.abs_value); |
1239 | #endif | 1239 | #endif |
1240 | GNUNET_assert (h->client == NULL); | 1240 | GNUNET_assert (h->client == NULL); |
1241 | GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); | 1241 | GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); |
1242 | h->reconnect_task | 1242 | h->reconnect_task |
1243 | = GNUNET_SCHEDULER_add_delayed (h->sched, | 1243 | = GNUNET_SCHEDULER_add_delayed (h->sched, |
1244 | h->reconnect_delay, &reconnect, h); | 1244 | h->reconnect_delay, &reconnect, h); |
1245 | if (h->reconnect_delay.value == 0) | 1245 | if (h->reconnect_delay.rel_value == 0) |
1246 | { | 1246 | { |
1247 | h->reconnect_delay = GNUNET_TIME_UNIT_MILLISECONDS; | 1247 | h->reconnect_delay = GNUNET_TIME_UNIT_MILLISECONDS; |
1248 | } | 1248 | } |
@@ -1798,12 +1798,12 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle | |||
1798 | GNUNET_break (0); | 1798 | GNUNET_break (0); |
1799 | return NULL; | 1799 | return NULL; |
1800 | } | 1800 | } |
1801 | 1801 | #if DEBUG_TRANSPORT | |
1802 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1802 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1803 | "Asking transport service for transmission of %u bytes to peer `%4s' within %llu ms.\n", | 1803 | "Asking transport service for transmission of %u bytes to peer `%4s' within %llu ms.\n", |
1804 | size, GNUNET_i2s (target), | 1804 | size, GNUNET_i2s (target), |
1805 | (unsigned long long) timeout.value); | 1805 | (unsigned long long) timeout.abs_value); |
1806 | 1806 | #endif | |
1807 | n = neighbour_find (handle, target); | 1807 | n = neighbour_find (handle, target); |
1808 | if (n == NULL) | 1808 | if (n == NULL) |
1809 | { | 1809 | { |