From a3e7ed93b6d55961d7fdb07daf37db9e0a9d80f3 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Thu, 15 Mar 2012 10:00:34 +0000 Subject: [PATCH] -fix --- src/gns/gns_api.c | 15 ++++++++++++--- src/gns/test_gns_simple_lookup.c | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 9a4c4cff0..53b8feef7 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -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 */ } diff --git a/src/gns/test_gns_simple_lookup.c b/src/gns/test_gns_simple_lookup.c index 0142677d7..f7443d1fd 100644 --- a/src/gns/test_gns_simple_lookup.c +++ b/src/gns/test_gns_simple_lookup.c @@ -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); -- 2.25.1