first disconnect from core to handle disconnect events nicely -- likely cause of...
authorChristian Grothoff <christian@grothoff.org>
Tue, 19 Jul 2011 13:33:55 +0000 (13:33 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 19 Jul 2011 13:33:55 +0000 (13:33 +0000)
src/dht/gnunet-service-dht.c

index be635d4a0bbb4964445af59af36ecf5a98fa5b2f..626ca79f47d6a3d70992c8d475b8c88203bb3ff9 100644 (file)
@@ -4998,6 +4998,15 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                          NULL);
       GNUNET_TRANSPORT_disconnect (transport_handle);
     }
+  if (coreAPI != NULL)
+    {
+#if DEBUG_DHT
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "%s:%s Disconnecting core!\n", my_short_id, "DHT");
+#endif
+      GNUNET_CORE_disconnect (coreAPI);
+      coreAPI = NULL;
+    }
   for (bucket_count = lowest_bucket; bucket_count < MAX_BUCKETS;
        bucket_count++)
     {
@@ -5012,15 +5021,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
           delete_peer (pos, bucket_count);
         }
     }
-  if (coreAPI != NULL)
-    {
-#if DEBUG_DHT
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "%s:%s Disconnecting core!\n", my_short_id, "DHT");
-#endif
-      GNUNET_CORE_disconnect (coreAPI);
-      coreAPI = NULL;
-    }
   if (datacache != NULL)
     {
 #if DEBUG_DHT