diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-01-28 16:30:22 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-01-28 16:30:22 +0000 |
commit | 12dd06d765a8e7cce38c1535231b3cef7e1288d7 (patch) | |
tree | 150fe73f111c5e1b0c5cbdaadff4b2b6a60b671f /src | |
parent | d30a39972be89da881324b8175984bf658620559 (diff) | |
download | gnunet-12dd06d765a8e7cce38c1535231b3cef7e1288d7.tar.gz gnunet-12dd06d765a8e7cce38c1535231b3cef7e1288d7.zip |
proper latency calculation, though I think maybe the time difference calculation should be a bit more flexible
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index d76e69b7b..fde9d8128 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -1712,6 +1712,7 @@ handle_pong (void *cls, const struct GNUNET_MessageHeader *message, | |||
1712 | int count = 0; | 1712 | int count = 0; |
1713 | unsigned int challenge = ntohl(pong->challenge); | 1713 | unsigned int challenge = ntohl(pong->challenge); |
1714 | pos = pending_validations; | 1714 | pos = pending_validations; |
1715 | |||
1715 | while (pos != NULL) | 1716 | while (pos != NULL) |
1716 | { | 1717 | { |
1717 | GNUNET_CRYPTO_hash (&pos->publicKey, | 1718 | GNUNET_CRYPTO_hash (&pos->publicKey, |
@@ -1756,7 +1757,14 @@ handle_pong (void *cls, const struct GNUNET_MessageHeader *message, | |||
1756 | GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); | 1757 | GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); |
1757 | matched = GNUNET_YES; | 1758 | matched = GNUNET_YES; |
1758 | va->peer_address->connected = GNUNET_YES; | 1759 | va->peer_address->connected = GNUNET_YES; |
1759 | va->peer_address->latency = GNUNET_TIME_absolute_get_difference(GNUNET_TIME_absolute_get(), va->send_time); | 1760 | va->peer_address->latency = GNUNET_TIME_absolute_get_difference(va->peer_address->validation->send_time, GNUNET_TIME_absolute_get()); |
1761 | #if DEBUG_TRANSPORT | ||
1762 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1763 | "Confirmed validity of address, peer `%4s' has address `%s', latency of %llu\n", | ||
1764 | GNUNET_i2s (peer), | ||
1765 | GNUNET_a2s ((const struct sockaddr *) sender_address, | ||
1766 | sender_address_len), (unsigned long long)va->peer_address->latency.value); | ||
1767 | #endif | ||
1760 | va->peer_address->transmit_ready = GNUNET_YES; | 1768 | va->peer_address->transmit_ready = GNUNET_YES; |
1761 | va->peer_address->expires = GNUNET_TIME_relative_to_absolute | 1769 | va->peer_address->expires = GNUNET_TIME_relative_to_absolute |
1762 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 1770 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
@@ -2082,9 +2090,6 @@ check_hello_validated (void *cls, | |||
2082 | chvc->e->next = pending_validations; | 2090 | chvc->e->next = pending_validations; |
2083 | pending_validations = chvc->e; | 2091 | pending_validations = chvc->e; |
2084 | } | 2092 | } |
2085 | /* no existing HELLO, all addresses are new */ | ||
2086 | /* GNUNET_HELLO_iterate_addresses (chvc->hello, | ||
2087 | GNUNET_NO, &run_validation, chvc->e);*/ | ||
2088 | 2093 | ||
2089 | if (h != NULL) | 2094 | if (h != NULL) |
2090 | { | 2095 | { |
@@ -2497,7 +2502,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2497 | default: | 2502 | default: |
2498 | #if DEBUG_TRANSPORT | 2503 | #if DEBUG_TRANSPORT |
2499 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2504 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2500 | "Received \n\nREAL MESSAGE\n\ntype %u from `%4s', sending to all clients.\n", | 2505 | "Received REAL MESSAGE type %u from `%4s', sending to all clients.\n", |
2501 | ntohs (message->type), GNUNET_i2s (peer)); | 2506 | ntohs (message->type), GNUNET_i2s (peer)); |
2502 | #endif | 2507 | #endif |
2503 | /* transmit message to all clients */ | 2508 | /* transmit message to all clients */ |