gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31053 - gnunet/src/mesh
Date: Thu, 5 Dec 2013 02:38:16 +0100

Author: bartpolot
Date: 2013-12-05 02:38:16 +0100 (Thu, 05 Dec 2013)
New Revision: 31053

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
Log:
- improve dealing with duplicate channel create (in case of replay attack / 
missed channel ACK)


Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-12-05 01:08:45 UTC 
(rev 31052)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-12-05 01:38:16 UTC 
(rev 31053)
@@ -1997,41 +1997,42 @@
     /* Create channel */
     ch = channel_new (t, NULL, 0);
     ch->gid = chid;
-  }
-  channel_set_options (ch, ntohl (msg->opt));
+    channel_set_options (ch, ntohl (msg->opt));
 
-  /* Find a destination client */
-  ch->port = ntohl (msg->port);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "   port %u\n", ch->port);
-  c = GML_client_get_by_port (ch->port);
-  if (NULL == c)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  no client has port registered\n");
-    if (is_loopback (ch))
+    /* Find a destination client */
+    ch->port = ntohl (msg->port);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "   port %u\n", ch->port);
+    c = GML_client_get_by_port (ch->port);
+    if (NULL == c)
     {
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "  loopback: destroy on handler\n");
-      send_nack (ch);
+      LOG (GNUNET_ERROR_TYPE_DEBUG, "  no client has port registered\n");
+      if (is_loopback (ch))
+      {
+        LOG (GNUNET_ERROR_TYPE_DEBUG, "  loopback: destroy on handler\n");
+        send_nack (ch);
+      }
+      else
+      {
+        LOG (GNUNET_ERROR_TYPE_DEBUG, "  not loopback: destroy now\n");
+        send_nack (ch);
+        GMCH_destroy (ch);
+      }
+      return NULL;
     }
     else
     {
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "  not loopback: destroy now\n");
-      send_nack (ch);
-      GMCH_destroy (ch);
+      LOG (GNUNET_ERROR_TYPE_DEBUG, "  client %p has port registered\n", c);
     }
-    return NULL;
+
+    add_destination (ch, c);
+    if (GNUNET_YES == ch->reliable)
+      LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");
+    else
+      LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n");
+
+    send_client_create (ch);
   }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  client %p has port registered\n", c);
-  }
 
-  add_destination (ch, c);
-  if (GNUNET_YES == ch->reliable)
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");
-  else
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n");
-
-  send_client_create (ch);
   send_ack (ch, GNUNET_YES);
 
   return ch;




reply via email to

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