diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-24 16:15:02 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-24 16:15:02 +0000 |
commit | 0f4bee916929a41fd6cc516cd6276685d283d706 (patch) | |
tree | 351ee64a09deccd3bcfb994d9d84550ff2789e45 /src/transport/gnunet-service-transport_clients.c | |
parent | 227d261c1ff256be9dea7bf98e5e07f7875dcde0 (diff) | |
download | gnunet-0f4bee916929a41fd6cc516cd6276685d283d706.tar.gz gnunet-0f4bee916929a41fd6cc516cd6276685d283d706.zip |
improving r17722
Diffstat (limited to 'src/transport/gnunet-service-transport_clients.c')
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 6b07136e8..50bb903c4 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -336,21 +336,22 @@ notify_client_about_neighbour (void *cls, | |||
336 | { | 336 | { |
337 | struct TransportClient *tc = cls; | 337 | struct TransportClient *tc = cls; |
338 | struct ConnectInfoMessage *cim; | 338 | struct ConnectInfoMessage *cim; |
339 | size_t size; | 339 | struct GNUNET_ATS_Information *ap; |
340 | size_t size = | ||
341 | sizeof (struct ConnectInfoMessage) + | ||
342 | ats_count * sizeof (struct GNUNET_ATS_Information); | ||
343 | char buf[size]; | ||
340 | 344 | ||
341 | size = | ||
342 | sizeof (struct ConnectInfoMessage) + | ||
343 | ats_count * sizeof (struct GNUNET_ATS_Information); | ||
344 | GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); | 345 | GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); |
345 | cim = GNUNET_malloc (size); | 346 | cim = (struct ConnectInfoMessage*) buf; |
346 | cim->header.size = htons (size); | 347 | cim->header.size = htons (size); |
347 | cim->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 348 | cim->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
348 | cim->ats_count = htonl (ats_count); | 349 | cim->ats_count = htonl (ats_count); |
349 | cim->id = *peer; | 350 | cim->id = *peer; |
350 | memcpy (&cim->ats, ats, | 351 | ap = (struct GNUNET_ATS_Information *) &cim[1]; |
352 | memcpy (ap, ats, | ||
351 | ats_count * sizeof (struct GNUNET_ATS_Information)); | 353 | ats_count * sizeof (struct GNUNET_ATS_Information)); |
352 | unicast (tc, &cim->header, GNUNET_NO); | 354 | unicast (tc, &cim->header, GNUNET_NO); |
353 | GNUNET_free (cim); | ||
354 | } | 355 | } |
355 | 356 | ||
356 | 357 | ||