gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30291 - gnunet/src/mesh
Date: Fri, 18 Oct 2013 13:13:33 +0200

Author: bartpolot
Date: 2013-10-18 13:13:33 +0200 (Fri, 18 Oct 2013)
New Revision: 30291

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- fixes


Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-18 10:03:29 UTC 
(rev 30290)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-10-18 11:13:33 UTC 
(rev 30291)
@@ -1086,18 +1086,32 @@
 
 /**
  * Notify a client that the channel is no longer valid.
- * FIXME send on tunnel if some client == NULL?
  *
  * @param ch Channel that is destroyed.
  */
 void
 GMCH_send_destroy (struct MeshChannel *ch)
 {
+  struct GNUNET_MESH_ChannelManage msg;
+
+  msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
+  msg.header.size = htons (sizeof (msg));
+  msg.chid = htonl (ch->gid);
+
+  /* If root is not NULL, notify.
+   * If it's NULL, check lid_root. When a local destroy comes in, root 
+   * is set to NULL but lid_root is left untouched. In this case, do nothing,
+   * the client is the one who reuqested the channel to be destroyed.
+   */
   if (NULL != ch->root)
     GML_send_channel_destroy (ch->root, ch->lid_root);
+  else if (0 == ch->lid_root)
+    GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO);
 
   if (NULL != ch->dest)
     GML_send_channel_destroy (ch->dest, ch->lid_dest);
+  else if (0 == ch->lid_dest)
+    GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES);
 }
 
 

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-18 10:03:29 UTC 
(rev 30290)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-18 11:13:33 UTC 
(rev 30291)
@@ -1405,13 +1405,14 @@
     }
     else
     {
+      /* Unexpected peer sending traffic on a connection. */
       GNUNET_break_op (0);
       return GNUNET_OK;
     }
   }
-  fc = fwd ? &c->bck_fc : &c->fwd_fc;
 
   /* Check PID */
+  fc = fwd ? &c->bck_fc : &c->fwd_fc;
   pid = ntohl (msg->pid);
   if (GMC_is_pid_bigger (pid, fc->last_ack_sent))
   {
@@ -1429,7 +1430,7 @@
                 pid, fc->last_pid_recv + 1);
     return GNUNET_OK;
   }
-  if (MESH_CONNECTION_SENT == c->state)
+  if (MESH_CONNECTION_SENT == c->state || MESH_CONNECTION_ACK == c->state)
     connection_change_state (c, MESH_CONNECTION_READY);
   connection_reset_timeout (c, fwd);
   fc->last_pid_recv = pid;

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-18 10:03:29 UTC 
(rev 30290)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-10-18 11:13:33 UTC 
(rev 30291)
@@ -474,7 +474,7 @@
  * @param fwd Is this message fwd?
  */
 static void
-handle_GMT_decrypted (struct MeshTunnel3 *t,
+handle_decrypted (struct MeshTunnel3 *t,
                   const struct GNUNET_MessageHeader *msgh,
                   int fwd)
 {
@@ -551,7 +551,7 @@
   while (off < payload_size)
   {
     msgh = (struct GNUNET_MessageHeader *) &cbuf[off];
-    handle_GMT_decrypted (t, msgh, fwd);
+        handle_decrypted (t, msgh, fwd);
     off += ntohs (msgh->size);
   }
 }
@@ -1172,9 +1172,9 @@
   unsigned int cs;
   unsigned int buffer;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Tunnel send %s ACKs on %s\n",
-              fwd ? "FWD" : "BCK", GMT_2s (t));
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Tunnel send %s ACKs on %s\n",
+       fwd ? "FWD" : "BCK", GMT_2s (t));
 
   if (NULL == t)
   {




reply via email to

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