aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-07-10 08:53:22 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-07-10 08:53:22 +0000
commit11fd564b2998cca1e02eb403794ec47fe5859a12 (patch)
tree82c54f644631ed3c933c09b275a83e6fe4149b3e /src/transport/gnunet-service-transport_neighbours.c
parentecf423bfc3a95ff966776559a3fd97da6cbd91b8 (diff)
downloadgnunet-11fd564b2998cca1e02eb403794ec47fe5859a12.tar.gz
gnunet-11fd564b2998cca1e02eb403794ec47fe5859a12.zip
move add function directly to transport
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c48
1 files changed, 5 insertions, 43 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 2ee10da47..269525a55 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -934,44 +934,6 @@ free_address (struct NeighbourAddress *na)
934 934
935 935
936/** 936/**
937 * Notify ATS about the new address including the network this address is
938 * located in.
939 *
940 * @param address the address
941 * @param session the session*
942 */
943static void
944add_address (struct GNUNET_HELLO_Address *address,
945 void *session)
946{
947 struct GNUNET_TRANSPORT_PluginFunctions *papi;
948 struct GNUNET_ATS_Information ats;
949 uint32_t net;
950
951 /* valid new address, let ATS know! */
952 if (NULL == address->transport_name)
953 {
954 GNUNET_break (0);
955 return;
956 }
957 if (NULL == (papi = GST_plugins_find (address->transport_name)))
958 {
959 /* we don't have the plugin for this address */
960 GNUNET_break (0);
961 return;
962 }
963
964 net = papi->get_network (NULL, session);
965 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
966 ats.value = htonl(net);
967// GNUNET_break (0);
968// fprintf (stderr, "NET: %u\n", ntohl(net));
969 GNUNET_ATS_address_add (GST_ats,
970 address, session, &ats, 1);
971}
972
973
974/**
975 * Initialize the 'struct NeighbourAddress'. 937 * Initialize the 'struct NeighbourAddress'.
976 * 938 *
977 * @param na neighbour address to initialize 939 * @param na neighbour address to initialize
@@ -1581,7 +1543,7 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour)
1581 else 1543 else
1582 latency = n->latency.rel_value; 1544 latency = n->latency.rel_value;
1583 ats.value = htonl (latency); 1545 ats.value = htonl (latency);
1584 GST_update_ats_metrics (&n->id, 1546 GST_ats_update_metrics (&n->id,
1585 n->primary_address.address, 1547 n->primary_address.address,
1586 n->primary_address.session, 1548 n->primary_address.session,
1587 &ats, 1); 1549 &ats, 1);
@@ -2026,7 +1988,7 @@ handle_test_blacklist_cont (void *cls,
2026 break; 1988 break;
2027 case S_CONNECT_RECV_BLACKLIST_INBOUND: 1989 case S_CONNECT_RECV_BLACKLIST_INBOUND:
2028 if (GNUNET_OK == result) 1990 if (GNUNET_OK == result)
2029 add_address (bcc->na.address, bcc->na.session); 1991 GST_ats_add_address (bcc->na.address, bcc->na.session);
2030 1992
2031 n->state = S_CONNECT_RECV_ATS; 1993 n->state = S_CONNECT_RECV_ATS;
2032 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 1994 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
@@ -2835,7 +2797,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2835 n->primary_address.bandwidth_in, 2797 n->primary_address.bandwidth_in,
2836 n->primary_address.bandwidth_out); 2798 n->primary_address.bandwidth_out);
2837 /* Tell ATS that the outbound session we created to send CONNECT was successfull */ 2799 /* Tell ATS that the outbound session we created to send CONNECT was successfull */
2838 add_address (n->primary_address.address, n->primary_address.session); 2800 GST_ats_add_address (n->primary_address.address, n->primary_address.session);
2839 set_address (&n->primary_address, 2801 set_address (&n->primary_address,
2840 n->primary_address.address, 2802 n->primary_address.address,
2841 n->primary_address.session, 2803 n->primary_address.session,
@@ -2881,7 +2843,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2881 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 2843 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
2882 GNUNET_break (GNUNET_NO == n->alternative_address.ats_active); 2844 GNUNET_break (GNUNET_NO == n->alternative_address.ats_active);
2883 2845
2884 add_address (n->alternative_address.address, n->alternative_address.session); 2846 GST_ats_add_address (n->alternative_address.address, n->alternative_address.session);
2885 set_address (&n->primary_address, 2847 set_address (&n->primary_address,
2886 n->alternative_address.address, 2848 n->alternative_address.address,
2887 n->alternative_address.session, 2849 n->alternative_address.session,
@@ -3089,7 +3051,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3089 n->primary_address.bandwidth_in, 3051 n->primary_address.bandwidth_in,
3090 n->primary_address.bandwidth_out); 3052 n->primary_address.bandwidth_out);
3091 3053
3092 add_address (n->primary_address.address, n->primary_address.session); 3054 GST_ats_add_address (n->primary_address.address, n->primary_address.session);
3093 set_address (&n->primary_address, 3055 set_address (&n->primary_address,
3094 n->primary_address.address, 3056 n->primary_address.address,
3095 n->primary_address.session, 3057 n->primary_address.session,