diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-21 13:30:51 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-21 13:30:51 +0000 |
commit | ca2c35b387a67eed4d5242a0da9533be26ed0bb2 (patch) | |
tree | 8286384e30179d8023c381c4a7ec51e7aba2918e /src | |
parent | 2d5ce53dfad6d68a4f7972d10bce5a08c7e8a7a9 (diff) | |
download | gnunet-ca2c35b387a67eed4d5242a0da9533be26ed0bb2.tar.gz gnunet-ca2c35b387a67eed4d5242a0da9533be26ed0bb2.zip |
ats related changes in transport
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 29 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_manipulation.c | 1 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 37 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.h | 22 | ||||
-rw-r--r-- | src/transport/gnunet-transport.c | 5 | ||||
-rw-r--r-- | src/transport/transport-testing.c | 5 | ||||
-rw-r--r-- | src/transport/transport.h | 6 | ||||
-rw-r--r-- | src/transport/transport_api.c | 9 |
8 files changed, 37 insertions, 77 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index cbe1f7b19..a0568c855 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -154,18 +154,15 @@ static struct GNUNET_TIME_Relative | |||
154 | process_payload (const struct GNUNET_PeerIdentity *peer, | 154 | process_payload (const struct GNUNET_PeerIdentity *peer, |
155 | const struct GNUNET_HELLO_Address *address, | 155 | const struct GNUNET_HELLO_Address *address, |
156 | struct Session *session, | 156 | struct Session *session, |
157 | const struct GNUNET_MessageHeader *message, | 157 | const struct GNUNET_MessageHeader *message) |
158 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | ||
159 | { | 158 | { |
160 | struct GNUNET_TIME_Relative ret; | 159 | struct GNUNET_TIME_Relative ret; |
161 | int do_forward; | 160 | int do_forward; |
162 | struct InboundMessage *im; | 161 | struct InboundMessage *im; |
163 | size_t msg_size = ntohs (message->size); | 162 | size_t msg_size = ntohs (message->size); |
164 | size_t size = | 163 | size_t size = |
165 | sizeof (struct InboundMessage) + msg_size + | 164 | sizeof (struct InboundMessage) + msg_size; |
166 | sizeof (struct GNUNET_ATS_Information) * (ats_count + 1); | ||
167 | char buf[size] GNUNET_ALIGN; | 165 | char buf[size] GNUNET_ALIGN; |
168 | struct GNUNET_ATS_Information *ap; | ||
169 | 166 | ||
170 | ret = GNUNET_TIME_UNIT_ZERO; | 167 | ret = GNUNET_TIME_UNIT_ZERO; |
171 | do_forward = GNUNET_SYSERR; | 168 | do_forward = GNUNET_SYSERR; |
@@ -190,17 +187,17 @@ process_payload (const struct GNUNET_PeerIdentity *peer, | |||
190 | im = (struct InboundMessage *) buf; | 187 | im = (struct InboundMessage *) buf; |
191 | im->header.size = htons (size); | 188 | im->header.size = htons (size); |
192 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); | 189 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); |
193 | im->ats_count = htonl (ats_count + 1); | ||
194 | im->peer = *peer; | 190 | im->peer = *peer; |
195 | ap = (struct GNUNET_ATS_Information *) &im[1]; | 191 | |
196 | memcpy (ap, ats, ats_count * sizeof (struct GNUNET_ATS_Information)); | 192 | fprintf (stderr, "FIX THIS: %s:%u \n", __FILE__, __LINE__); |
193 | /* | ||
197 | ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 194 | ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
198 | ap[ats_count].value = | 195 | ap[ats_count].value = |
199 | htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value); | 196 | htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);*/ |
200 | memcpy (&ap[ats_count + 1], message, ntohs (message->size)); | 197 | memcpy (&im[1], message, ntohs (message->size)); |
201 | 198 | ||
202 | GNUNET_ATS_address_add (GST_ats, address, session, ap, ats_count + 1); | 199 | GNUNET_ATS_address_add (GST_ats, address, session, NULL, 0); |
203 | GNUNET_ATS_address_update (GST_ats, address, session, ap, ats_count + 1); | 200 | GNUNET_ATS_address_update (GST_ats, address, session, NULL, 0); |
204 | GST_clients_broadcast (&im->header, GNUNET_YES); | 201 | GST_clients_broadcast (&im->header, GNUNET_YES); |
205 | 202 | ||
206 | return ret; | 203 | return ret; |
@@ -280,10 +277,10 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
280 | GST_neighbours_handle_connect (message, peer, &address, session); | 277 | GST_neighbours_handle_connect (message, peer, &address, session); |
281 | break; | 278 | break; |
282 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK: | 279 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK: |
283 | GST_neighbours_handle_connect_ack (message, peer, &address, session, NULL, 0); | 280 | GST_neighbours_handle_connect_ack (message, peer, &address, session); |
284 | break; | 281 | break; |
285 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK: | 282 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK: |
286 | GST_neighbours_handle_session_ack (message, peer, &address, session, NULL, 0); | 283 | GST_neighbours_handle_session_ack (message, peer, &address, session); |
287 | break; | 284 | break; |
288 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: | 285 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: |
289 | GST_neighbours_handle_disconnect_message (peer, message); | 286 | GST_neighbours_handle_disconnect_message (peer, message); |
@@ -292,7 +289,7 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
292 | GST_neighbours_keepalive (peer); | 289 | GST_neighbours_keepalive (peer); |
293 | break; | 290 | break; |
294 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE: | 291 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE: |
295 | GST_neighbours_keepalive_response (peer, NULL, 0); | 292 | GST_neighbours_keepalive_response (peer); |
296 | break; | 293 | break; |
297 | default: | 294 | default: |
298 | /* should be payload */ | 295 | /* should be payload */ |
@@ -300,7 +297,7 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
300 | gettext_noop | 297 | gettext_noop |
301 | ("# bytes payload received"), | 298 | ("# bytes payload received"), |
302 | ntohs (message->size), GNUNET_NO); | 299 | ntohs (message->size), GNUNET_NO); |
303 | ret = process_payload (peer, &address, session, message, NULL, 0); | 300 | ret = process_payload (peer, &address, session, message); |
304 | break; | 301 | break; |
305 | } | 302 | } |
306 | end: | 303 | end: |
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index 203a67771..c01c9d4dc 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c | |||
@@ -370,6 +370,7 @@ GST_manipulation_metrics_recv (void *cls, | |||
370 | uint32_t m_distance; | 370 | uint32_t m_distance; |
371 | int d; | 371 | int d; |
372 | 372 | ||
373 | |||
373 | m_distance = 0; | 374 | m_distance = 0; |
374 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) | 375 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) |
375 | { | 376 | { |
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 | */ |
1511 | void | 1509 | void |
1512 | GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, | 1510 | GST_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 | |||
2757 | GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | 2752 | GST_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 | */ |
3036 | void | 3027 | void |
3037 | GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | 3028 | GST_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, |
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h index bb3d4d2d3..70b6d1096 100644 --- a/src/transport/gnunet-service-transport_neighbours.h +++ b/src/transport/gnunet-service-transport_neighbours.h | |||
@@ -138,13 +138,9 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour); | |||
138 | * to this peer | 138 | * to this peer |
139 | * | 139 | * |
140 | * @param neighbour neighbour to keep alive | 140 | * @param neighbour neighbour to keep alive |
141 | * @param ats performance data | ||
142 | * @param ats_count number of entries in ats | ||
143 | */ | 141 | */ |
144 | void | 142 | void |
145 | GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, | 143 | GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour); |
146 | const struct GNUNET_ATS_Information *ats, | ||
147 | uint32_t ats_count); | ||
148 | 144 | ||
149 | 145 | ||
150 | /** | 146 | /** |
@@ -244,9 +240,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
244 | * @param address address of the other peer, NULL if other peer | 240 | * @param address address of the other peer, NULL if other peer |
245 | * connected to us | 241 | * connected to us |
246 | * @param session session to use (or NULL) | 242 | * @param session session to use (or NULL) |
247 | * @param ats performance data | 243 | */ |
248 | * @param ats_count number of entries in ats (excluding 0-termination) | ||
249 | */ | ||
250 | void | 244 | void |
251 | GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | 245 | GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, |
252 | const struct GNUNET_PeerIdentity *peer, | 246 | const struct GNUNET_PeerIdentity *peer, |
@@ -263,16 +257,12 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
263 | * @param address address of the other peer, NULL if other peer | 257 | * @param address address of the other peer, NULL if other peer |
264 | * connected to us | 258 | * connected to us |
265 | * @param session session to use (or NULL) | 259 | * @param session session to use (or NULL) |
266 | * @param ats performance data | ||
267 | * @param ats_count number of entries in ats | ||
268 | */ | 260 | */ |
269 | void | 261 | void |
270 | GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | 262 | GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, |
271 | const struct GNUNET_PeerIdentity *peer, | 263 | const struct GNUNET_PeerIdentity *peer, |
272 | const struct GNUNET_HELLO_Address *address, | 264 | const struct GNUNET_HELLO_Address *address, |
273 | struct Session *session, | 265 | struct Session *session); |
274 | const struct GNUNET_ATS_Information *ats, | ||
275 | uint32_t ats_count); | ||
276 | 266 | ||
277 | 267 | ||
278 | /** | 268 | /** |
@@ -284,16 +274,12 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
284 | * @param address address of the other peer, NULL if other peer | 274 | * @param address address of the other peer, NULL if other peer |
285 | * connected to us | 275 | * connected to us |
286 | * @param session session to use (or NULL) | 276 | * @param session session to use (or NULL) |
287 | * @param ats performance data | ||
288 | * @param ats_count number of entries in ats | ||
289 | */ | 277 | */ |
290 | void | 278 | void |
291 | GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | 279 | GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, |
292 | const struct GNUNET_PeerIdentity *peer, | 280 | const struct GNUNET_PeerIdentity *peer, |
293 | const struct GNUNET_HELLO_Address *address, | 281 | const struct GNUNET_HELLO_Address *address, |
294 | struct Session *session, | 282 | struct Session *session); |
295 | const struct GNUNET_ATS_Information *ats, | ||
296 | uint32_t ats_count); | ||
297 | 283 | ||
298 | 284 | ||
299 | /** | 285 | /** |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 5dea54887..d606f05b9 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -648,13 +648,10 @@ monitor_notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
648 | * @param cls closure | 648 | * @param cls closure |
649 | * @param peer (claimed) identity of the other peer | 649 | * @param peer (claimed) identity of the other peer |
650 | * @param message the message | 650 | * @param message the message |
651 | * @param ats performance data | ||
652 | * @param ats_count number of entries in ats | ||
653 | */ | 651 | */ |
654 | static void | 652 | static void |
655 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | 653 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, |
656 | const struct GNUNET_MessageHeader *message, | 654 | const struct GNUNET_MessageHeader *message) |
657 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | ||
658 | { | 655 | { |
659 | if (benchmark_receive) | 656 | if (benchmark_receive) |
660 | { | 657 | { |
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 32331d9d9..bb0b86077 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -145,15 +145,14 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
145 | 145 | ||
146 | static void | 146 | static void |
147 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | 147 | notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, |
148 | const struct GNUNET_MessageHeader *message, | 148 | const struct GNUNET_MessageHeader *message) |
149 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | ||
150 | { | 149 | { |
151 | struct PeerContext *p = cls; | 150 | struct PeerContext *p = cls; |
152 | 151 | ||
153 | if (p == NULL) | 152 | if (p == NULL) |
154 | return; | 153 | return; |
155 | if (p->rec != NULL) | 154 | if (p->rec != NULL) |
156 | p->rec (p->cb_cls, peer, message, ats, ats_count); | 155 | p->rec (p->cb_cls, peer, message); |
157 | } | 156 | } |
158 | 157 | ||
159 | 158 | ||
diff --git a/src/transport/transport.h b/src/transport/transport.h index be31f0ad6..d5413f779 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h | |||
@@ -235,12 +235,6 @@ struct InboundMessage | |||
235 | struct GNUNET_MessageHeader header; | 235 | struct GNUNET_MessageHeader header; |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Number of ATS key-value pairs that follow this struct | ||
239 | * (excluding the 0-terminator). | ||
240 | */ | ||
241 | uint32_t ats_count GNUNET_PACKED; | ||
242 | |||
243 | /** | ||
244 | * Which peer sent the message? | 238 | * Which peer sent the message? |
245 | */ | 239 | */ |
246 | struct GNUNET_PeerIdentity peer; | 240 | struct GNUNET_PeerIdentity peer; |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 3b72ead5f..8b66fb986 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -619,11 +619,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
619 | break; | 619 | break; |
620 | } | 620 | } |
621 | im = (const struct InboundMessage *) msg; | 621 | im = (const struct InboundMessage *) msg; |
622 | ats_count = ntohl (im->ats_count); | 622 | imm = (const struct GNUNET_MessageHeader *) &im[1]; |
623 | ats = (const struct GNUNET_ATS_Information *) &im[1]; | 623 | if (ntohs (imm->size) + sizeof (struct InboundMessage) != size) |
624 | imm = (const struct GNUNET_MessageHeader *) &ats[ats_count]; | ||
625 | if (ntohs (imm->size) + sizeof (struct InboundMessage) + | ||
626 | ats_count * sizeof (struct GNUNET_ATS_Information) != size) | ||
627 | { | 624 | { |
628 | GNUNET_break (0); | 625 | GNUNET_break (0); |
629 | break; | 626 | break; |
@@ -637,7 +634,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) | |||
637 | break; | 634 | break; |
638 | } | 635 | } |
639 | if (h->rec != NULL) | 636 | if (h->rec != NULL) |
640 | h->rec (h->cls, &im->peer, imm, ats, ats_count); | 637 | h->rec (h->cls, &im->peer, imm); |
641 | break; | 638 | break; |
642 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA: | 639 | case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA: |
643 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "SET_QUOTA"); | 640 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "SET_QUOTA"); |