-fix
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Thu, 15 Mar 2012 10:00:34 +0000 (10:00 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Thu, 15 Mar 2012 10:00:34 +0000 (10:00 +0000)
src/gns/gns_api.c
src/gns/test_gns_simple_lookup.c

index 9a4c4cff0f4a95d55a9b46281f562c09ef6628fb..53b8feef7d726a72126ac7dac8406f907b0934c0 100644 (file)
@@ -468,7 +468,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
               "Got message\n");
   if (msg == NULL)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
          "Error receiving data from GNS service, reconnecting\n");
     force_reconnect (handle);
     return;
@@ -489,6 +489,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break_op (0);
       GNUNET_CLIENT_receive (handle->client, &process_message, handle,
                              GNUNET_TIME_UNIT_FOREVER_REL);
+      return;
     }
 
     for (qe = handle->lookup_head; qe != NULL; qe = qe->next)
@@ -515,6 +516,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break_op (0);
       GNUNET_CLIENT_receive (handle->client, &process_message, handle,
                              GNUNET_TIME_UNIT_FOREVER_REL);
+      return;
     }
 
     for (qe = handle->shorten_head; qe != NULL; qe = qe->next)
@@ -539,6 +541,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break_op (0);
       GNUNET_CLIENT_receive (handle->client, &process_message, handle,
                              GNUNET_TIME_UNIT_FOREVER_REL);
+      return;
     }
 
     for (qe = handle->get_auth_head; qe != NULL; qe = qe->next)
@@ -587,9 +590,15 @@ GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
  * @param handle handle of the GNS connection to stop
  */
 void
-GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle)
+GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *h)
 {
-  GNUNET_CLIENT_disconnect (handle->client, 0);
+  GNUNET_CLIENT_disconnect (h->client, GNUNET_NO);
+  if (GNUNET_SCHEDULER_NO_TASK != h->reconnect_task)
+  {
+    GNUNET_SCHEDULER_cancel (h->reconnect_task);
+    h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
+  }
+  GNUNET_free(h);
   /* disco from GNS */
 }
 
index 0142677d7e4cb7d705568a9faf0b4cfc372c59cf..f7443d1fd1e480d12236ed5ffeccefe433f1f2a2 100644 (file)
@@ -137,6 +137,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
       }
     }
   }
+  GNUNET_GNS_disconnect(gns_handle);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer1!\n");
   GNUNET_TESTING_daemon_stop (d1, TIMEOUT, &shutdown_callback, NULL,
                               GNUNET_YES, GNUNET_NO);