diff options
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 29 |
1 files changed, 13 insertions, 16 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: |