lock solver during shutdown to terminate faster
authorChristian Grothoff <christian@grothoff.org>
Wed, 16 Mar 2016 21:48:33 +0000 (21:48 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 16 Mar 2016 21:48:33 +0000 (21:48 +0000)
src/ats/gnunet-service-ats.c
src/ats/gnunet-service-ats_addresses.c
src/ats/gnunet-service-ats_connectivity.c

index 2906e6046b12ec32c78b7aebe9325e52d54bfc9e..11db62e2d1ec93cd8880809510e29b11ce77131d 100644 (file)
@@ -130,6 +130,8 @@ static void
 cleanup_task (void *cls,
               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "ATS shutdown initiated\n");
   GAS_connectivity_done ();
   GAS_addresses_done ();
   GAS_plugin_done ();
index a49a002e9cf7122d6b5475cfeee30e9597501b07..d8f467688e63ee1115445291f1ca5a999c799e41 100644 (file)
@@ -405,7 +405,9 @@ GAS_addresses_done ()
 {
   GNUNET_log(GNUNET_ERROR_TYPE_INFO,
              "Shutting down addresses\n");
+  GAS_plugin_solver_lock ();
   GAS_addresses_destroy_all ();
+  GAS_plugin_solver_unlock ();
   GNUNET_CONTAINER_multipeermap_destroy (GSA_addresses);
   GSA_addresses = NULL;
 }
index 38c953c9cd11ac016c0fce7adc8333698be4010f..2cf434c70b7024f054d37530a1ba138744528e33 100644 (file)
@@ -217,9 +217,11 @@ free_request (void *cls,
 void
 GAS_connectivity_done ()
 {
+  GAS_plugin_solver_lock ();
   GNUNET_CONTAINER_multipeermap_iterate (connection_requests,
                                          &free_request,
                                          NULL);
+  GAS_plugin_solver_unlock ();
   GNUNET_CONTAINER_multipeermap_destroy (connection_requests);
   connection_requests = NULL;
 }