[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35640 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35640 - gnunet/src/cadet |
Date: |
Mon, 27 Apr 2015 21:15:41 +0200 |
Author: bartpolot
Date: 2015-04-27 21:15:41 +0200 (Mon, 27 Apr 2015)
New Revision: 35640
Modified:
gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
- refactor
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2015-04-27 19:15:39 UTC
(rev 35639)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2015-04-27 19:15:41 UTC
(rev 35640)
@@ -2134,6 +2134,7 @@
struct CadetFlowControl *fc;
struct CadetPeer *hop;
int fwd;
+ uint16_t type;
/* Check size */
if (ntohs (message->size) < minimum_size)
@@ -2177,11 +2178,13 @@
}
/* Check PID for payload messages */
- if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == ntohs (message->type))
+ type = ntohs (message->type);
+ if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type
+ || GNUNET_MESSAGE_TYPE_CADET_AX == type)
{
fc = fwd ? &c->bck_fc : &c->fwd_fc;
LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected %u - %u)\n",
- pid, fc->last_pid_recv + 1, fc->last_ack_sent);
+ pid, fc->last_pid_recv + 1, fc->last_ack_sent);
if (GC_is_pid_bigger (pid, fc->last_ack_sent))
{
GNUNET_break_op (0);
@@ -3135,17 +3138,26 @@
struct GNUNET_CADET_ConnectionBroken *bmsg;
uint32_t ttl;
+ case GNUNET_MESSAGE_TYPE_CADET_AX:
case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
- emsg = (struct GNUNET_CADET_Encrypted *) data;
- ttl = ntohl (emsg->ttl);
- if (0 == ttl)
+ if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type)
{
- GNUNET_break_op (0);
- GNUNET_free (data);
- return NULL;
+ emsg = (struct GNUNET_CADET_Encrypted *) data;
+ ttl = ntohl (emsg->ttl);
+ if (0 == ttl)
+ {
+ GNUNET_break_op (0);
+ GNUNET_free (data);
+ return NULL;
+ }
+ emsg->cid = c->id;
+ emsg->ttl = htonl (ttl - 1);
}
- emsg->cid = c->id;
- emsg->ttl = htonl (ttl - 1);
+ else
+ {
+ axmsg = (struct GNUNET_CADET_AX *) data;
+ axmsg->cid = c->id;
+ }
LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n);
LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid sent %u\n", fc->last_pid_sent);
LOG (GNUNET_ERROR_TYPE_DEBUG, " ack recv %u\n", fc->last_ack_recv);
@@ -3162,13 +3174,6 @@
GCC_start_poll (c, fwd);
}
break;
- case GNUNET_MESSAGE_TYPE_CADET_AX:
- axmsg = (struct GNUNET_CADET_AX *) data;
- axmsg->cid = c->id;
- LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid sent %u\n", fc->last_pid_sent);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " ack recv %u\n", fc->last_ack_recv);
- break;
case GNUNET_MESSAGE_TYPE_CADET_KX:
kmsg = (struct GNUNET_CADET_KX *) data;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35640 - gnunet/src/cadet,
gnunet <=