aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-03-21 13:30:51 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-03-21 13:30:51 +0000
commitca2c35b387a67eed4d5242a0da9533be26ed0bb2 (patch)
tree8286384e30179d8023c381c4a7ec51e7aba2918e /src/transport/gnunet-service-transport_neighbours.c
parent2d5ce53dfad6d68a4f7972d10bce5a08c7e8a7a9 (diff)
downloadgnunet-ca2c35b387a67eed4d5242a0da9533be26ed0bb2.tar.gz
gnunet-ca2c35b387a67eed4d5242a0da9533be26ed0bb2.zip
ats related changes in transport
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 21b5d06d6..2b010732d 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1505,17 +1505,13 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour)
1505 * plus calculated latency) to ATS. 1505 * plus calculated latency) to ATS.
1506 * 1506 *
1507 * @param neighbour neighbour to keep alive 1507 * @param neighbour neighbour to keep alive
1508 * @param ats performance data
1509 * @param ats_count number of entries in ats
1510 */ 1508 */
1511void 1509void
1512GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, 1510GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour)
1513 const struct GNUNET_ATS_Information *ats,
1514 uint32_t ats_count)
1515{ 1511{
1516 struct NeighbourMapEntry *n; 1512 struct NeighbourMapEntry *n;
1517 uint32_t latency; 1513 uint32_t latency;
1518 struct GNUNET_ATS_Information ats_new[ats_count + 1]; 1514 struct GNUNET_ATS_Information ats;
1519 1515
1520 if (NULL == (n = lookup_neighbour (neighbour))) 1516 if (NULL == (n = lookup_neighbour (neighbour)))
1521 { 1517 {
@@ -1540,18 +1536,17 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1540 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1541 "Latency for peer `%s' is %llu ms\n", 1537 "Latency for peer `%s' is %llu ms\n",
1542 GNUNET_i2s (&n->id), n->latency.rel_value); 1538 GNUNET_i2s (&n->id), n->latency.rel_value);
1543 memcpy (ats_new, ats, sizeof (struct GNUNET_ATS_Information) * ats_count);
1544 /* append latency */ 1539 /* append latency */
1545 ats_new[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 1540 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
1546 if (n->latency.rel_value > UINT32_MAX) 1541 if (n->latency.rel_value > UINT32_MAX)
1547 latency = UINT32_MAX; 1542 latency = UINT32_MAX;
1548 else 1543 else
1549 latency = n->latency.rel_value; 1544 latency = n->latency.rel_value;
1550 ats_new[ats_count].value = htonl (latency); 1545 ats.value = htonl (latency);
1546 fprintf (stderr, "FIX THIS: %s %u \n", __FILE__, __LINE__);
1551 GNUNET_ATS_address_update (GST_ats, 1547 GNUNET_ATS_address_update (GST_ats,
1552 n->primary_address.address, 1548 n->primary_address.address,
1553 n->primary_address.session, ats_new, 1549 n->primary_address.session, &ats, 1);
1554 ats_count + 1);
1555} 1550}
1556 1551
1557 1552
@@ -2757,9 +2752,7 @@ void
2757GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, 2752GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2758 const struct GNUNET_PeerIdentity *peer, 2753 const struct GNUNET_PeerIdentity *peer,
2759 const struct GNUNET_HELLO_Address *address, 2754 const struct GNUNET_HELLO_Address *address,
2760 struct Session *session, 2755 struct Session *session)
2761 const struct GNUNET_ATS_Information *ats,
2762 uint32_t ats_count)
2763{ 2756{
2764 const struct SessionConnectMessage *scm; 2757 const struct SessionConnectMessage *scm;
2765 struct GNUNET_TIME_Absolute ts; 2758 struct GNUNET_TIME_Absolute ts;
@@ -2807,14 +2800,14 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2807 gettext_noop ("# peers connected"), 2800 gettext_noop ("# peers connected"),
2808 ++neighbours_connected, 2801 ++neighbours_connected,
2809 GNUNET_NO); 2802 GNUNET_NO);
2810 connect_notify_cb (callback_cls, &n->id, ats, ats_count, 2803 connect_notify_cb (callback_cls, &n->id, NULL, 0,
2811 n->primary_address.bandwidth_in, 2804 n->primary_address.bandwidth_in,
2812 n->primary_address.bandwidth_out); 2805 n->primary_address.bandwidth_out);
2813 /* Tell ATS that the outbound session we created to send CONNECT was successfull */ 2806 /* Tell ATS that the outbound session we created to send CONNECT was successfull */
2814 GNUNET_ATS_address_add (GST_ats, 2807 GNUNET_ATS_address_add (GST_ats,
2815 n->primary_address.address, 2808 n->primary_address.address,
2816 n->primary_address.session, 2809 n->primary_address.session,
2817 ats, ats_count); 2810 NULL, 0);
2818 set_address (&n->primary_address, 2811 set_address (&n->primary_address,
2819 n->primary_address.address, 2812 n->primary_address.address,
2820 n->primary_address.session, 2813 n->primary_address.session,
@@ -2862,7 +2855,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2862 GNUNET_ATS_address_add(GST_ats, 2855 GNUNET_ATS_address_add(GST_ats,
2863 n->alternative_address.address, 2856 n->alternative_address.address,
2864 n->alternative_address.session, 2857 n->alternative_address.session,
2865 ats, ats_count); 2858 NULL, 0);
2866 set_address (&n->primary_address, 2859 set_address (&n->primary_address,
2867 n->alternative_address.address, 2860 n->alternative_address.address,
2868 n->alternative_address.session, 2861 n->alternative_address.session,
@@ -3030,16 +3023,12 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3030 * @param address address of the other peer, NULL if other peer 3023 * @param address address of the other peer, NULL if other peer
3031 * connected to us 3024 * connected to us
3032 * @param session session to use (or NULL) 3025 * @param session session to use (or NULL)
3033 * @param ats performance data
3034 * @param ats_count number of entries in ats
3035 */ 3026 */
3036void 3027void
3037GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, 3028GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3038 const struct GNUNET_PeerIdentity *peer, 3029 const struct GNUNET_PeerIdentity *peer,
3039 const struct GNUNET_HELLO_Address *address, 3030 const struct GNUNET_HELLO_Address *address,
3040 struct Session *session, 3031 struct Session *session)
3041 const struct GNUNET_ATS_Information *ats,
3042 uint32_t ats_count)
3043{ 3032{
3044 struct NeighbourMapEntry *n; 3033 struct NeighbourMapEntry *n;
3045 3034
@@ -3070,13 +3059,13 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3070 gettext_noop ("# peers connected"), 3059 gettext_noop ("# peers connected"),
3071 ++neighbours_connected, 3060 ++neighbours_connected,
3072 GNUNET_NO); 3061 GNUNET_NO);
3073 connect_notify_cb (callback_cls, &n->id, ats, ats_count, 3062 connect_notify_cb (callback_cls, &n->id, NULL, 0,
3074 n->primary_address.bandwidth_in, 3063 n->primary_address.bandwidth_in,
3075 n->primary_address.bandwidth_out); 3064 n->primary_address.bandwidth_out);
3076 GNUNET_ATS_address_add(GST_ats, 3065 GNUNET_ATS_address_add(GST_ats,
3077 n->primary_address.address, 3066 n->primary_address.address,
3078 n->primary_address.session, 3067 n->primary_address.session,
3079 ats, ats_count); 3068 NULL, 0);
3080 set_address (&n->primary_address, 3069 set_address (&n->primary_address,
3081 n->primary_address.address, 3070 n->primary_address.address,
3082 n->primary_address.session, 3071 n->primary_address.session,