gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30887 - gnunet/src/mesh
Date: Wed, 27 Nov 2013 02:42:35 +0100

Author: bartpolot
Date: 2013-11-27 02:42:35 +0100 (Wed, 27 Nov 2013)
New Revision: 30887

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_connection.h
Log:
- dont try to send data on connections that are going to be destroyed


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-27 01:41:43 UTC 
(rev 30886)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-27 01:42:35 UTC 
(rev 30887)
@@ -334,6 +334,8 @@
       return "MESH_CONNECTION_ACK";
     case MESH_CONNECTION_READY:
       return "MESH_CONNECTION_READY";
+    case MESH_CONNECTION_DESTROYED:
+      return "MESH_CONNECTION_DESTROYED";
     default:
       return "MESH_CONNECTION_STATE_ERROR";
   }
@@ -379,6 +381,11 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG,
               "Connection %s state was %s\n",
               GMC_2s (c), GMC_state2s (c->state));
+  if (MESH_CONNECTION_DESTROYED == c->state)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n");
+    return;
+  }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
               "Connection %s state is now %s\n",
               GMC_2s (c), GMC_state2s (state));
@@ -1520,6 +1527,7 @@
   }
   GMC_send_prebuilt_message (message, c, fwd, NULL, NULL);
   c->destroy = GNUNET_YES;
+  c->state = MESH_CONNECTION_DESTROYED;
 
   return GNUNET_OK;
 }
@@ -2399,6 +2407,7 @@
    * (the one we just scheduled), so no point in checking whether to
    * destroy immediately. */
   c->destroy = GNUNET_YES;
+  c->state = MESH_CONNECTION_DESTROYED;
 
   /**
    * Cancel all queues, if no message is left, connection will be destroyed.
@@ -2691,6 +2700,7 @@
   if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO))
     GMC_send_prebuilt_message (&msg.header, c, GNUNET_NO, NULL, NULL);
   c->destroy = GNUNET_YES;
+  c->state = MESH_CONNECTION_DESTROYED;
 }
 
 

Modified: gnunet/src/mesh/gnunet-service-mesh_connection.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-11-27 01:41:43 UTC 
(rev 30886)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.h    2013-11-27 01:42:35 UTC 
(rev 30887)
@@ -64,6 +64,11 @@
    * Connection confirmed, ready to carry traffic.
    */
   MESH_CONNECTION_READY,
+
+  /**
+   * Connection to be destroyed, just waiting to empty queues.
+   */
+  MESH_CONNECTION_DESTROYED,
 };
 
 




reply via email to

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