gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31323 - gnunet/src/mesh
Date: Thu, 12 Dec 2013 19:00:07 +0100

Author: bartpolot
Date: 2013-12-12 19:00:06 +0100 (Thu, 12 Dec 2013)
New Revision: 31323

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- react to connection destrutcion in exisitng tunnel


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-12-12 17:45:27 UTC 
(rev 31322)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-12-12 18:00:06 UTC 
(rev 31323)
@@ -2564,7 +2564,7 @@
   memcpy (data, message, size);
   type = ntohs (message->type);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u bytes) on connection %s\n",
-              GM_m2s (type), size, GMC_2s (c));
+       GM_m2s (type), size, GMC_2s (c));
 
   fc = fwd ? &c->fwd_fc : &c->bck_fc;
   droppable = GNUNET_NO == force;

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-12-12 17:45:27 UTC 
(rev 31322)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2013-12-12 18:00:06 UTC 
(rev 31323)
@@ -768,7 +768,7 @@
     tq->tqd = NULL;
   }
   tq->cq = GMC_send_prebuilt_message (&msg->header, c, fwd, force,
-                                  &message_sent, tq);
+                                      &message_sent, tq);
   tq->cont = cont;
   tq->cont_cls = cont_cls;
 
@@ -1748,7 +1748,10 @@
 GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c)
 {
   struct MeshTConnection *aux;
+  unsigned int i;
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n",
+       GMC_2s (c), GMT_2s (t));
   for (aux = t->connection_head; aux != NULL; aux = aux->next)
     if (aux->c == c)
     {
@@ -1756,6 +1759,26 @@
       GNUNET_free (aux);
       return;
     }
+
+  /* Start new connections if needed */
+  if (NULL == t->connection_head)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  no more connections\n");
+    GMP_connect (t->peer);
+    t->cstate = MESH_TUNNEL3_SEARCHING;
+    return;
+  }
+
+  /* If not marked as ready, no change is needed */
+  if (MESH_TUNNEL3_READY != t->cstate)
+    return;
+
+  /* Check if any connection is ready to maintaing cstate */
+  for (aux = t->connection_head; aux != NULL; aux = aux->next)
+    if (MESH_CONNECTION_READY == GMC_get_state (aux->c))
+      return;
+
+  t->cstate = MESH_TUNNEL3_WAITING;
 }
 
 




reply via email to

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