[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r38226 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r38226 - gnunet/src/cadet |
Date: |
Thu, 27 Oct 2016 08:18:17 +0200 |
Author: bartpolot
Date: 2016-10-27 08:18:17 +0200 (Thu, 27 Oct 2016)
New Revision: 38226
Modified:
gnunet/src/cadet/gnunet-service-cadet_connection.c
gnunet/src/cadet/gnunet-service-cadet_tunnel.c
Log:
Build messages fully in tunnel code, avoid copying in connection layer
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2016-10-27 06:18:16 UTC
(rev 38225)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2016-10-27 06:18:17 UTC
(rev 38226)
@@ -3268,37 +3268,6 @@
size = ntohs (message->size);
type = ntohs (message->type);
- /* Allocate a copy of the message on the stack, so we can modify it as
needed,
- * adding the Connection ID, PID, and other data the Tunnel layer doesn't
- * have access to.
- */
- char cbuf[size];
- struct GNUNET_MessageHeader *copy = (struct GNUNET_MessageHeader *)cbuf;
-
- if (GNUNET_MESSAGE_TYPE_CADET_AX == type
- || GNUNET_MESSAGE_TYPE_CADET_KX == type)
- {
- GNUNET_memcpy (copy, message, size);
- if (GNUNET_MESSAGE_TYPE_CADET_AX == type)
- {
- struct GNUNET_CADET_AX *axmsg;
-
- axmsg = (struct GNUNET_CADET_AX *) copy;
- axmsg->cid = c->id;
- axmsg->pid = htonl (GCC_get_pid (c, fwd));
- }
- else /* case GNUNET_MESSAGE_TYPE_CADET_KX */
- {
- struct GNUNET_CADET_KX *kmsg;
-
- GNUNET_assert (GNUNET_MESSAGE_TYPE_CADET_KX == type);
- kmsg = (struct GNUNET_CADET_KX *) copy;
- kmsg->reserved = htonl (0);
- kmsg->cid = c->id;
- }
- message = copy;
- }
-
GCC_check_connections ();
fc = fwd ? &c->fwd_fc : &c->bck_fc;
if (0 == fc->queue_max)
@@ -3307,8 +3276,6 @@
return NULL;
}
- size = ntohs (message->size);
- type = ntohs (message->type);
LOG (GNUNET_ERROR_TYPE_INFO,
"--> %s (%s %4u) on conn %s (%p) %s [%5u]\n",
GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c,
Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2016-10-27 06:18:16 UTC
(rev 38225)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2016-10-27 06:18:17 UTC
(rev 38226)
@@ -1406,6 +1406,9 @@
}
return NULL; /* Drop... */
}
+ fwd = GCC_is_origin (c, GNUNET_YES);
+ ax_msg->cid = *GCC_get_id (c);
+ ax_msg->pid = htonl (GCC_get_pid (c, fwd));
mid = 0;
type = ntohs (message->type);
@@ -1430,8 +1433,6 @@
}
LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s\n", GC_m2s (type));
- fwd = GCC_is_origin (c, GNUNET_YES);
-
if (NULL == cont)
{
GNUNET_break (NULL == GCC_send_prebuilt_message (msg, type, mid, c, fwd,
@@ -1612,6 +1613,7 @@
msg = (struct GNUNET_CADET_KX *) cbuf;
msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX);
msg->header.size = htons (sizeof (struct GNUNET_CADET_KX) + size);
+ msg->reserved = htonl (0);
c = tunnel_get_connection (t);
if (NULL == c)
{
@@ -1622,6 +1624,7 @@
}
return NULL;
}
+ msg->cid = *GCC_get_id (c);
switch (type)
{
case GNUNET_MESSAGE_TYPE_CADET_AX_KX:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r38226 - gnunet/src/cadet,
gnunet <=