gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28240 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r28240 - gnunet/src/mesh
Date: Mon, 22 Jul 2013 15:28:32 +0200

Author: bartpolot
Date: 2013-07-22 15:28:32 +0200 (Mon, 22 Jul 2013)
New Revision: 28240

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
- move tunnel number verification to function

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2013-07-22 13:06:16 UTC (rev 
28239)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2013-07-22 13:28:32 UTC (rev 
28240)
@@ -2161,13 +2161,17 @@
 static struct MeshTunnel *
 tunnel_get_by_local_id (struct MeshClient *c, MESH_TunnelNumber tid)
 {
+  if (0 == (tid & GNUNET_MESH_LOCAL_TUNNEL_ID_CLI))
+  {
+    GNUNET_break_op (0);
+    return NULL;
+  }
   if (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV)
   {
     return tunnel_get_incoming (tid);
   }
   else
   {
-    GNUNET_assert (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_CLI);
     return GNUNET_CONTAINER_multihashmap32_get (c->own_tunnels, tid);
   }
 }
@@ -4950,14 +4954,7 @@
   t_msg = (struct GNUNET_MESH_TunnelMessage *) message;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  towards %s\n",
               GNUNET_i2s (&t_msg->peer));
-  /* Sanity check for tunnel numbering */
   tid = ntohl (t_msg->tunnel_id);
-  if (0 == (tid & GNUNET_MESH_LOCAL_TUNNEL_ID_CLI))
-  {
-    GNUNET_break (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
   /* Sanity check for duplicate tunnel IDs */
   if (NULL != tunnel_get_by_local_id (c, tid))
   {
@@ -5118,12 +5115,6 @@
 
   /* Tunnel exists? */
   tid = ntohl (data_msg->tid);
-  if (tid < GNUNET_MESH_LOCAL_TUNNEL_ID_CLI)
-  {
-    GNUNET_break (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
   t = tunnel_get_by_local_id (c, tid);
   if (NULL == t)
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]