From 02ff54a5f5daec8a93d75991a77b8e27b22708aa Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Mon, 5 Mar 2012 09:48:41 +0000 Subject: [PATCH] - fix for 2192 --- src/namestore/namestore_api.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index fa681c566..e4dae859b 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -834,16 +834,26 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop) if (h->th != NULL) { GNUNET_CLIENT_notify_transmit_ready_cancel(h->th); + h->th = NULL; } + if (h->client != NULL) + { + struct DisconnectContext *d_ctx = GNUNET_malloc (sizeof (struct DisconnectContext)); + d_ctx->h = h; + d_ctx->drop = drop; - struct DisconnectContext *d_ctx = GNUNET_malloc (sizeof (struct DisconnectContext)); - d_ctx->h = h; - d_ctx->drop = drop; - - h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, sizeof (struct DisconnectMessage), + h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, sizeof (struct DisconnectMessage), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_NO, &transmit_disconnect_to_namestore, d_ctx); + } + else + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not send disconnect notification to namestore service, we are not connected!\n"); + if (GNUNET_YES == drop) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NAMESTORE will not drop content\n"); + GNUNET_SCHEDULER_add_now (&clean_up_task, h); + } } -- 2.25.1