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 /src | |
parent | 26b518ea7d7958e289680908326bb1e698c8b64e (diff) | |
download | gnunet-8d02205bfc76bd089189d640c4bfa3c49cfda061.tar.gz gnunet-8d02205bfc76bd089189d640c4bfa3c49cfda061.zip |
fixing ATS data
Diffstat (limited to 'src')
-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 ffe40f8c1..685113b10 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, | |||
186 | im->header.size = htons (size); | 186 | im->header.size = htons (size); |
187 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); | 187 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); |
188 | im->peer = *peer; | 188 | im->peer = *peer; |
189 | |||
190 | fprintf (stderr, "FIX THIS: %s:%u \n", __FILE__, __LINE__); | ||
191 | /* | ||
192 | ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | ||
193 | ap[ats_count].value = | ||
194 | htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);*/ | ||
195 | memcpy (&im[1], message, ntohs (message->size)); | 189 | memcpy (&im[1], message, ntohs (message->size)); |
196 | 190 | ||
197 | GNUNET_ATS_address_add (GST_ats, address, session, NULL, 0); | 191 | GNUNET_ATS_address_add (GST_ats, address, session, NULL, 0); |
198 | GNUNET_ATS_address_update (GST_ats, address, session, NULL, 0); | ||
199 | GST_clients_broadcast (&im->header, GNUNET_YES); | 192 | GST_clients_broadcast (&im->header, GNUNET_YES); |
200 | 193 | ||
201 | return ret; | 194 | return ret; |
@@ -407,6 +400,16 @@ plugin_env_address_to_type (void *cls, | |||
407 | return GNUNET_ATS_address_get_type(GST_ats, addr, addrlen); | 400 | return GNUNET_ATS_address_get_type(GST_ats, addr, addrlen); |
408 | } | 401 | } |
409 | 402 | ||
403 | void | ||
404 | GST_update_ats_metrics (struct GNUNET_PeerIdentity *peer, | ||
405 | struct GNUNET_HELLO_Address *address, | ||
406 | struct Session *session, | ||
407 | struct GNUNET_ATS_Information *ats, | ||
408 | uint32_t ats_count) | ||
409 | { | ||
410 | GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count); | ||
411 | } | ||
412 | |||
410 | /** | 413 | /** |
411 | * Function that will be called to figure if an address is an loopback, | 414 | * Function that will be called to figure if an address is an loopback, |
412 | * LAN, WAN etc. address | 415 | * LAN, WAN etc. address |
@@ -418,8 +421,8 @@ plugin_env_address_to_type (void *cls, | |||
418 | */ | 421 | */ |
419 | static void | 422 | static void |
420 | plugin_env_update_metrics (void *cls, | 423 | plugin_env_update_metrics (void *cls, |
421 | const struct GNUNET_PeerIdentity *peer, | 424 | struct GNUNET_PeerIdentity *peer, |
422 | const char *address, | 425 | const void *address, |
423 | uint16_t address_len, | 426 | uint16_t address_len, |
424 | struct Session *session, | 427 | struct Session *session, |
425 | struct GNUNET_ATS_Information *ats, | 428 | struct GNUNET_ATS_Information *ats, |
@@ -437,7 +440,7 @@ plugin_env_update_metrics (void *cls, | |||
437 | haddress.address_length = address_len; | 440 | haddress.address_length = address_len; |
438 | haddress.transport_name = plugin_name; | 441 | haddress.transport_name = plugin_name; |
439 | 442 | ||
440 | GNUNET_ATS_address_update (GST_ats, &haddress, session, ats, ats_count); | 443 | GST_update_ats_metrics (peer, &haddress, session, ats, ats_count); |
441 | } | 444 | } |
442 | 445 | ||
443 | 446 | ||
@@ -688,7 +691,7 @@ key_generation_cb (void *cls, | |||
688 | &plugin_env_address_change_notification, | 691 | &plugin_env_address_change_notification, |
689 | &plugin_env_session_end, | 692 | &plugin_env_session_end, |
690 | &plugin_env_address_to_type, | 693 | &plugin_env_address_to_type, |
691 | &GST_manipulation_metrics_recv); | 694 | &plugin_env_update_metrics); |
692 | GST_neighbours_start (NULL, | 695 | GST_neighbours_start (NULL, |
693 | &neighbours_connect_notification, | 696 | &neighbours_connect_notification, |
694 | &neighbours_disconnect_notification, | 697 | &neighbours_disconnect_notification, |
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 4f0aa924a..9a4233f01 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, | |||
97 | const char *sender_address, | 97 | const char *sender_address, |
98 | uint16_t sender_address_len); | 98 | uint16_t sender_address_len); |
99 | 99 | ||
100 | void | ||
101 | GST_update_ats_metrics (struct GNUNET_PeerIdentity *peer, | ||
102 | struct GNUNET_HELLO_Address *address, | ||
103 | struct Session *session, | ||
104 | struct GNUNET_ATS_Information *ats, | ||
105 | uint32_t ats_count); | ||
100 | 106 | ||
101 | #endif | 107 | #endif |
102 | /* end of file gnunet-service-transport_plugins.h */ | 108 | /* 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 c01c9d4dc..831d8fd5d 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 | |||
357 | */ | 357 | */ |
358 | void | 358 | void |
359 | GST_manipulation_metrics_recv (void *cls, | 359 | GST_manipulation_metrics_recv (void *cls, |
360 | const struct GNUNET_PeerIdentity *peer, | 360 | struct GNUNET_PeerIdentity *peer, |
361 | const char *address, | 361 | const char *address, |
362 | uint16_t address_len, | 362 | uint16_t address_len, |
363 | struct Session *session, | 363 | struct Session *session, |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index ee23af7fc..6c51dacca 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) | |||
1543 | else | 1543 | else |
1544 | latency = n->latency.rel_value; | 1544 | latency = n->latency.rel_value; |
1545 | ats.value = htonl (latency); | 1545 | ats.value = htonl (latency); |
1546 | fprintf (stderr, "FIX THIS: %s %u \n", __FILE__, __LINE__); | 1546 | GST_update_ats_metrics (&n->id, |
1547 | GNUNET_ATS_address_update (GST_ats, | 1547 | n->primary_address.address, |
1548 | n->primary_address.address, | 1548 | n->primary_address.session, |
1549 | n->primary_address.session, &ats, 1); | 1549 | &ats, 1); |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | 1552 | ||
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 3c4c6f624..93b29402e 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c | |||
@@ -484,12 +484,12 @@ env_session_end (void *cls, | |||
484 | 484 | ||
485 | static void | 485 | static void |
486 | env_update_metrics (void *cls, | 486 | env_update_metrics (void *cls, |
487 | const struct GNUNET_PeerIdentity *peer, | 487 | struct GNUNET_PeerIdentity *peer, |
488 | const char *address, | 488 | const void *address, |
489 | uint16_t address_len, | 489 | uint16_t address_len, |
490 | struct Session *session, | 490 | struct Session *session, |
491 | struct GNUNET_ATS_Information *ats, | 491 | struct GNUNET_ATS_Information *ats, |
492 | uint32_t ats_count) | 492 | uint32_t ats_count) |
493 | { | 493 | { |
494 | } | 494 | } |
495 | 495 | ||