gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r32986 - gnunet/src/mesh
Date: Wed, 9 Apr 2014 12:56:51 +0200

Author: bartpolot
Date: 2014-04-09 12:56:51 +0200 (Wed, 09 Apr 2014)
New Revision: 32986

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
Log:
- send buffered data to client before destroying channel

Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2014-04-09 10:56:49 UTC 
(rev 32985)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2014-04-09 10:56:51 UTC 
(rev 32986)
@@ -600,7 +600,6 @@
            " reliable && don't have %u, next is %u\n",
            rel->mid_recv,
            copy->mid);
-      return;
     }
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data END\n");
@@ -1125,7 +1124,6 @@
 
   if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages)
   {
-    struct MeshTunnel3 *t = rel->ch->t;
     GMCH_destroy (rel->ch);
     return GNUNET_YES;
   }
@@ -1671,8 +1669,17 @@
 
   rel->client_ready = GNUNET_YES;
   send_client_buffered_data (ch, c, fwd);
-  if (is_loopback (ch))
+
+  if (GNUNET_YES == ch->destroy && 0 == rel->n_recv)
   {
+    send_destroy (ch, GNUNET_YES);
+    GMCH_destroy (ch);
+  }
+  /* if loopback is marked for destruction, no need to ACK to the other peer,
+   * it requested the destruction and is already gone, therefore, else if.
+   */
+  else if (is_loopback (ch))
+  {
     unsigned int buffer;
 
     buffer = GMCH_get_buffer (ch, fwd);
@@ -1774,8 +1781,6 @@
                            struct MeshClient *c,
                            int is_root)
 {
-  struct MeshTunnel3 *t;
-
   ch->destroy = GNUNET_YES;
   /* Cleanup after the tunnel */
   if (GNUNET_NO == is_root && c == ch->dest)
@@ -1791,7 +1796,6 @@
     ch->root = NULL;
   }
 
-  t = ch->t;
   send_destroy (ch, GNUNET_NO);
   if (0 == ch->pending_messages)
     GMCH_destroy (ch);
@@ -2221,6 +2225,8 @@
                      const struct GNUNET_MESH_ChannelManage *msg,
                      int fwd)
 {
+  struct MeshChannelReliability *rel;
+
   /* If this is a remote (non-loopback) channel, find 'fwd'. */
   if (GNUNET_SYSERR == fwd)
   {
@@ -2240,9 +2246,16 @@
     return;
   }
 
-
-  send_destroy (ch, GNUNET_YES);
-  GMCH_destroy (ch);
+  rel = fwd ? ch->dest_rel : ch->root_rel;
+  if (0 == rel->n_recv)
+  {
+    send_destroy (ch, GNUNET_YES);
+    GMCH_destroy (ch);
+  }
+  else
+  {
+    ch->destroy = GNUNET_YES;
+  }
 }
 
 




reply via email to

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