gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17927 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r17927 - gnunet/src/transport
Date: Wed, 2 Nov 2011 15:55:03 +0100

Author: wachs
Date: 2011-11-02 15:55:03 +0100 (Wed, 02 Nov 2011)
New Revision: 17927

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
+ prevent bug https://www.gnunet.org/bugs/view.php?id=1868
+ changes shutdown order to send DISCONNECT Messages


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-11-02 14:48:26 UTC 
(rev 17926)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-11-02 14:55:03 UTC 
(rev 17927)
@@ -466,8 +466,9 @@
 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GST_validation_stop ();
+  GST_neighbours_stop ();
   GST_plugins_unload ();
-  GST_neighbours_stop ();
+
   GNUNET_ATS_scheduling_done (GST_ats);
   GST_ats = NULL;
   GST_clients_stop ();

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-11-02 
14:48:26 UTC (rev 17926)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-11-02 
14:55:03 UTC (rev 17927)
@@ -579,7 +579,14 @@
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
   size_t ret = GNUNET_SYSERR;
 
-  GNUNET_assert (plugin_name != NULL);
+  /* FIXME : ats returns an address with all values 0 */
+  if (((plugin_name == NULL) && (addr == NULL) && (addrlen == 0 )) ||
+      ((plugin_name == NULL) && (session == NULL)))
+  {
+    if (cont != NULL)
+      cont (cont_cls, target, GNUNET_SYSERR);
+    return GNUNET_SYSERR;
+  }
   papi = GST_plugins_find (plugin_name);
   if (papi == NULL)
   {
@@ -1000,7 +1007,11 @@
 void
 GST_neighbours_stop ()
 {
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 
   GNUNET_CONTAINER_multihashmap_iterate (neighbours, 
&disconnect_all_neighbours,
                                          NULL);
@@ -1189,7 +1200,11 @@
   size_t msg_len;
   size_t ret;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return GNUNET_NO;
+  }
   n = lookup_neighbour (peer);
   if (NULL == n)
   {
@@ -1382,7 +1397,11 @@
 {
   struct NeighbourMapEntry *n;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to peer `%s'\n",
               GNUNET_i2s (target));
@@ -1426,7 +1445,11 @@
 {
   struct NeighbourMapEntry *n;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return GNUNET_NO;
+  }
 
   n = lookup_neighbour (target);
 
@@ -1448,7 +1471,11 @@
 {
   struct NeighbourMapEntry *n;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1502,7 +1529,11 @@
   struct NeighbourMapEntry *n;
   struct MessageQueue *mq;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 
   n = lookup_neighbour (target);
   if ((n == NULL) || (!is_connected(n)))
@@ -1583,7 +1614,11 @@
   struct NeighbourMapEntry *n;
   struct GNUNET_TIME_Relative ret;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return GNUNET_TIME_UNIT_FOREVER_REL;
+  }
 
   n = lookup_neighbour (sender);
   if (n == NULL)
@@ -1666,7 +1701,11 @@
 {
   struct NeighbourMapEntry *n;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 
   n = lookup_neighbour (neighbour);
   if (NULL == n)
@@ -1696,7 +1735,11 @@
 {
   struct NeighbourMapEntry *n;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 
   n = lookup_neighbour (neighbour);
   if (n == NULL)
@@ -1772,7 +1815,11 @@
 {
   struct IteratorContext ic;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 
   ic.cb = cb;
   ic.cb_cls = cb_cls;
@@ -1789,7 +1836,11 @@
 {
   struct NeighbourMapEntry *n;
 
-  GNUNET_assert (neighbours != NULL);
+  // This can happen during shutdown
+  if (neighbours == NULL)
+  {
+    return;
+  }
 
   n = lookup_neighbour (target);
   if (NULL == n)




reply via email to

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