gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r34006 - gnunet/src/cadet
Date: Tue, 22 Jul 2014 04:54:12 +0200

Author: bartpolot
Date: 2014-07-22 04:54:12 +0200 (Tue, 22 Jul 2014)
New Revision: 34006

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
   gnunet/src/cadet/gnunet-service-cadet_connection.h
Log:
- add connection state BROKEN for connections destroyed on behalf of 
intermediate nodes

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-21 10:13:44 UTC 
(rev 34005)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-22 02:54:12 UTC 
(rev 34006)
@@ -378,6 +378,8 @@
       return "CADET_CONNECTION_READY";
     case CADET_CONNECTION_DESTROYED:
       return "CADET_CONNECTION_DESTROYED";
+    case CADET_CONNECTION_BROKEN:
+      return "CADET_CONNECTION_BROKEN";
     default:
       GNUNET_break (0);
       LOG (GNUNET_ERROR_TYPE_ERROR, " conn state %u unknown!\n", s);
@@ -424,7 +426,7 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Connection %s state %s -> %s\n",
        GCC_2s (c), GCC_state2s (c->state), GCC_state2s (state));
-  if (CADET_CONNECTION_DESTROYED == c->state)
+  if (CADET_CONNECTION_DESTROYED <= c->state) /* Destroyed or broken. */
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n");
     return;
@@ -1415,7 +1417,7 @@
   if (GNUNET_OK != GCP_remove_connection (peer, c))
   {
     GNUNET_assert (CADET_CONNECTION_NEW == c->state
-                   || CADET_CONNECTION_DESTROYED == c->state);
+                   || CADET_CONNECTION_DESTROYED <= c->state);
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  cstate: %u\n", c->state);
     if (NULL != c->t) GCT_debug (c->t, GNUNET_ERROR_TYPE_DEBUG);
   }
@@ -1424,7 +1426,7 @@
   if (GNUNET_OK != GCP_remove_connection (peer, c))
   {
     GNUNET_assert (CADET_CONNECTION_NEW == c->state
-                   || CADET_CONNECTION_DESTROYED == c->state);
+                   || CADET_CONNECTION_DESTROYED <= c->state);
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  cstate: %u\n", c->state);
     if (NULL != c->t) GCT_debug (c->t, GNUNET_ERROR_TYPE_DEBUG);
   }
@@ -1840,7 +1842,7 @@
     endpoint = GCP_get_short (c->path->peers[c->path->length - 1]);
     path_invalidate (c->path);
     GCP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2);
-    c->state = CADET_CONNECTION_DESTROYED;
+    c->state = CADET_CONNECTION_BROKEN;
     GCT_remove_connection (t, c);
     c->t = NULL;
     pending = c->pending_messages;
@@ -1853,8 +1855,10 @@
       GCT_resend_message (out_msg, t);
     }
     /* All pending messages should have been popped,
-     * and the connection destroyed by the continuation. */
-    if (0 < pending)
+     * and the connection destroyed by the continuation.
+     * If last message was just deleted, then continuation wasn't called.
+     */
+    if (0 < pending || 0 < del)
     {
       GNUNET_break (0);
       GCC_destroy (c);

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.h  2014-07-21 10:13:44 UTC 
(rev 34005)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.h  2014-07-22 02:54:12 UTC 
(rev 34006)
@@ -69,6 +69,11 @@
    * Connection to be destroyed, just waiting to empty queues.
    */
   CADET_CONNECTION_DESTROYED,
+
+  /**
+   * Connection to be destroyed because of a distant peer, same as DESTROYED.
+   */
+  CADET_CONNECTION_BROKEN,
 };
 
 




reply via email to

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