aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet_connection.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2016-10-27 06:18:17 +0000
committerBart Polot <bart@net.in.tum.de>2016-10-27 06:18:17 +0000
commit6a0ded9c43e7e8407e8944f3e62a9d3d08726062 (patch)
treea17e9de6151e135c2c1c0b58e01a18b063fb99c1 /src/cadet/gnunet-service-cadet_connection.c
parent13776e033db3631575c7be41c4b457b90e166fbe (diff)
downloadgnunet-6a0ded9c43e7e8407e8944f3e62a9d3d08726062.tar.gz
gnunet-6a0ded9c43e7e8407e8944f3e62a9d3d08726062.zip
Build messages fully in tunnel code, avoid copying in connection layer
Diffstat (limited to 'src/cadet/gnunet-service-cadet_connection.c')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index eb13cb637..4a4de2200 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -3268,37 +3268,6 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
3268 size = ntohs (message->size); 3268 size = ntohs (message->size);
3269 type = ntohs (message->type); 3269 type = ntohs (message->type);
3270 3270
3271 /* Allocate a copy of the message on the stack, so we can modify it as needed,
3272 * adding the Connection ID, PID, and other data the Tunnel layer doesn't
3273 * have access to.
3274 */
3275 char cbuf[size];
3276 struct GNUNET_MessageHeader *copy = (struct GNUNET_MessageHeader *)cbuf;
3277
3278 if (GNUNET_MESSAGE_TYPE_CADET_AX == type
3279 || GNUNET_MESSAGE_TYPE_CADET_KX == type)
3280 {
3281 GNUNET_memcpy (copy, message, size);
3282 if (GNUNET_MESSAGE_TYPE_CADET_AX == type)
3283 {
3284 struct GNUNET_CADET_AX *axmsg;
3285
3286 axmsg = (struct GNUNET_CADET_AX *) copy;
3287 axmsg->cid = c->id;
3288 axmsg->pid = htonl (GCC_get_pid (c, fwd));
3289 }
3290 else /* case GNUNET_MESSAGE_TYPE_CADET_KX */
3291 {
3292 struct GNUNET_CADET_KX *kmsg;
3293
3294 GNUNET_assert (GNUNET_MESSAGE_TYPE_CADET_KX == type);
3295 kmsg = (struct GNUNET_CADET_KX *) copy;
3296 kmsg->reserved = htonl (0);
3297 kmsg->cid = c->id;
3298 }
3299 message = copy;
3300 }
3301
3302 GCC_check_connections (); 3271 GCC_check_connections ();
3303 fc = fwd ? &c->fwd_fc : &c->bck_fc; 3272 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3304 if (0 == fc->queue_max) 3273 if (0 == fc->queue_max)
@@ -3307,8 +3276,6 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
3307 return NULL; 3276 return NULL;
3308 } 3277 }
3309 3278
3310 size = ntohs (message->size);
3311 type = ntohs (message->type);
3312 LOG (GNUNET_ERROR_TYPE_INFO, 3279 LOG (GNUNET_ERROR_TYPE_INFO,
3313 "--> %s (%s %4u) on conn %s (%p) %s [%5u]\n", 3280 "--> %s (%s %4u) on conn %s (%p) %s [%5u]\n",
3314 GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c, 3281 GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c,