diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-22 15:50:08 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-22 15:50:08 +0000 |
commit | 8d02205bfc76bd089189d640c4bfa3c49cfda061 (patch) | |
tree | a62dccdfbdf476308de87f719548a2dee1775e74 | |
parent | 26b518ea7d7958e289680908326bb1e698c8b64e (diff) |
fixing ATS data
-rw-r--r-- | src/transport/gnunet-service-transport.c | 25 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.h | 6 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_manipulation.c | 2 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 8 | ||||
-rw-r--r-- | src/transport/test_plugin_transport.c | 12 |
5 files changed, 31 insertions, 22 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index ffe40f8c14..685113b100 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -186,16 +186,9 @@ process_payload (const struct GNUNET_PeerIdentity *peer, im->header.size = htons (size); im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); im->peer = *peer; - - fprintf (stderr, "FIX THIS: %s:%u \n", __FILE__, __LINE__); - /* - ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); - ap[ats_count].value = - htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);*/ memcpy (&im[1], message, ntohs (message->size)); GNUNET_ATS_address_add (GST_ats, address, session, NULL, 0); - GNUNET_ATS_address_update (GST_ats, address, session, NULL, 0); GST_clients_broadcast (&im->header, GNUNET_YES); return ret; @@ -407,6 +400,16 @@ plugin_env_address_to_type (void *cls, return GNUNET_ATS_address_get_type(GST_ats, addr, addrlen); } +void +GST_update_ats_metrics (struct GNUNET_PeerIdentity *peer, + struct GNUNET_HELLO_Address *address, + struct Session *session, + struct GNUNET_ATS_Information *ats, + uint32_t ats_count) +{ + GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count); +} + /** * Function that will be called to figure if an address is an loopback, * LAN, WAN etc. address @@ -418,8 +421,8 @@ plugin_env_address_to_type (void *cls, */ static void plugin_env_update_metrics (void *cls, - const struct GNUNET_PeerIdentity *peer, - const char *address, + struct GNUNET_PeerIdentity *peer, + const void *address, uint16_t address_len, struct Session *session, struct GNUNET_ATS_Information *ats, @@ -437,7 +440,7 @@ plugin_env_update_metrics (void *cls, haddress.address_length = address_len; haddress.transport_name = plugin_name; - GNUNET_ATS_address_update (GST_ats, &haddress, session, ats, ats_count); + GST_update_ats_metrics (peer, &haddress, session, ats, ats_count); } @@ -688,7 +691,7 @@ key_generation_cb (void *cls, &plugin_env_address_change_notification, &plugin_env_session_end, &plugin_env_address_to_type, - &GST_manipulation_metrics_recv); + &plugin_env_update_metrics); GST_neighbours_start (NULL, &neighbours_connect_notification, &neighbours_disconnect_notification, diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 4f0aa924ad..9a4233f012 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h @@ -97,6 +97,12 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, const char *sender_address, uint16_t sender_address_len); +void +GST_update_ats_metrics (struct GNUNET_PeerIdentity *peer, + struct GNUNET_HELLO_Address *address, + struct Session *session, + struct GNUNET_ATS_Information *ats, + uint32_t ats_count); #endif /* end of file gnunet-service-transport_plugins.h */ diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index c01c9d4dc8..831d8fd5d5 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c @@ -357,7 +357,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg */ void GST_manipulation_metrics_recv (void *cls, - const struct GNUNET_PeerIdentity *peer, + struct GNUNET_PeerIdentity *peer, const char *address, uint16_t address_len, struct Session *session, diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index ee23af7fc0..6c51daccad 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -1543,10 +1543,10 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour) else latency = n->latency.rel_value; ats.value = htonl (latency); - fprintf (stderr, "FIX THIS: %s %u \n", __FILE__, __LINE__); - GNUNET_ATS_address_update (GST_ats, - n->primary_address.address, - n->primary_address.session, &ats, 1); + GST_update_ats_metrics (&n->id, + n->primary_address.address, + n->primary_address.session, + &ats, 1); } diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 3c4c6f6244..93b29402ec 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -484,12 +484,12 @@ env_session_end (void *cls, static void env_update_metrics (void *cls, - const struct GNUNET_PeerIdentity *peer, - const char *address, - uint16_t address_len, - struct Session *session, - struct GNUNET_ATS_Information *ats, - uint32_t ats_count) + struct GNUNET_PeerIdentity *peer, + const void *address, + uint16_t address_len, + struct Session *session, + struct GNUNET_ATS_Information *ats, + uint32_t ats_count) { } |