gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34000 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r34000 - gnunet/src/cadet
Date: Mon, 21 Jul 2014 02:15:29 +0200

Author: bartpolot
Date: 2014-07-21 02:15:29 +0200 (Mon, 21 Jul 2014)
New Revision: 34000

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
   gnunet/src/cadet/gnunet-service-cadet_local.c
   gnunet/src/cadet/gnunet-service-cadet_peer.c
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
   gnunet/src/cadet/gnunet-service-cadet_tunnel.h
Log:
- fix tunnel state management after connection failure<

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-21 00:15:28 UTC 
(rev 33999)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-21 00:15:29 UTC 
(rev 34000)
@@ -1709,7 +1709,7 @@
   }
   else if (get_prev_hop (c) == pi)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  ACK\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  FINAL ACK\n");
     fwd = GNUNET_YES;
     connection_change_state (c, CADET_CONNECTION_READY);
   }
@@ -2693,7 +2693,7 @@
   struct CadetFlowControl *fc;
 
   fc = fwd ? &c->fwd_fc : &c->bck_fc;
-  if (GC_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent))
+  if (GC_is_pid_bigger (fc->last_pid_recv, fc->last_ack_sent))
   {
     return 0;
   }

Modified: gnunet/src/cadet/gnunet-service-cadet_local.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_local.c       2014-07-21 00:15:28 UTC 
(rev 33999)
+++ gnunet/src/cadet/gnunet-service-cadet_local.c       2014-07-21 00:15:29 UTC 
(rev 34000)
@@ -771,7 +771,7 @@
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
   msg.destination = *peer;
   msg.channels = htonl (GCT_count_channels (t));
-  msg.connections = htonl (GCT_count_connections (t));
+  msg.connections = htonl (GCT_count_any_connections (t));
   msg.cstate = htons ((uint16_t) GCT_get_cstate (t));
   msg.estate = htons ((uint16_t) GCT_get_estate (t));
 
@@ -900,7 +900,7 @@
 
   /* Initialize context */
   ch_n = GCT_count_channels (t);
-  c_n = GCT_count_connections (t);
+  c_n = GCT_count_any_connections (t);
 
   size = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
   size += c_n * sizeof (struct GNUNET_CADET_Hash);

Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c        2014-07-21 00:15:28 UTC 
(rev 33999)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c        2014-07-21 00:15:29 UTC 
(rev 34000)
@@ -1708,8 +1708,7 @@
   {
     GCD_search_stop (peer->search_h);
     peer->search_h = NULL;
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "  Stopping DHT GET for peer %s\n",
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  Stopping DHT GET for peer %s\n",
          GCP_2s (peer));
   }
 
@@ -1721,7 +1720,8 @@
     LOG (GNUNET_ERROR_TYPE_DEBUG,
                 "  Starting DHT GET for peer %s\n", GCP_2s (peer));
     peer->search_h = GCD_search (id, &search_handler, peer);
-    if (CADET_TUNNEL_NEW == GCT_get_cstate (t))
+    if (CADET_TUNNEL_NEW == GCT_get_cstate (t)
+        || 0 == GCT_count_any_connections (t))
       GCT_change_cstate (t, CADET_TUNNEL_SEARCHING);
   }
 }

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-07-21 00:15:28 UTC 
(rev 33999)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-07-21 00:15:29 UTC 
(rev 34000)
@@ -2361,8 +2361,7 @@
       && CADET_TUNNEL_SHUTDOWN != t->cstate
       && GNUNET_NO == shutting_down)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  no more connections, getting new ones\n");
-    GCT_change_cstate (t, CADET_TUNNEL_SEARCHING);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  too few connections, getting new ones\n");
     GCP_connect (t->peer);
     return;
   }
@@ -2674,13 +2673,36 @@
 
 
 /**
- * Count created connections of a tunnel. Not necessarily ready connections!
+ * Count all created connections of a tunnel. Not necessarily ready 
connections!
  *
  * @param t Tunnel on which to count.
  *
  * @return Number of connections created, either being established or ready.
  */
 unsigned int
+GCT_count_any_connections (struct CadetTunnel *t)
+{
+  struct CadetTConnection *iter;
+  unsigned int count;
+
+  if (NULL == t)
+    return 0;
+
+  for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next)
+    count++;
+
+  return count;
+}
+
+
+/**
+ * Count established (ready) connections of a tunnel.
+ *
+ * @param t Tunnel on which to count.
+ *
+ * @return Number of connections.
+ */
+unsigned int
 GCT_count_connections (struct CadetTunnel *t)
 {
   struct CadetTConnection *iter;
@@ -2696,6 +2718,7 @@
   return count;
 }
 
+
 /**
  * Count channels of a tunnel.
  *

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.h      2014-07-21 00:15:28 UTC 
(rev 33999)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.h      2014-07-21 00:15:29 UTC 
(rev 34000)
@@ -51,7 +51,7 @@
   CADET_TUNNEL_NEW,
 
     /**
-     * Path to the peer not known yet.
+     * No path to the peer known yet.
      */
   CADET_TUNNEL_SEARCHING,
 
@@ -312,6 +312,16 @@
 GCT_use_path (struct CadetTunnel *t, struct CadetPeerPath *p);
 
 /**
+ * Count all created connections of a tunnel. Not necessarily ready 
connections!
+ *
+ * @param t Tunnel on which to count.
+ *
+ * @return Number of connections created, either being established or ready.
+ */
+unsigned int
+GCT_count_any_connections (struct CadetTunnel *t);
+
+/**
  * Count established (ready) connections of a tunnel.
  *
  * @param t Tunnel on which to count.




reply via email to

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