From f76e7c10d09a037ffd102a0f4998ba86c5e14f97 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 23 Oct 2011 10:06:07 +0000 Subject: getting rid of unnecessary ignore_shutdown calls --- src/arm/arm_api.c | 3 --- src/arm/test_exponential_backoff.c | 2 +- src/include/gnunet_client_lib.h | 12 ------------ src/util/client.c | 23 ----------------------- src/util/connection.c | 3 ++- 5 files changed, 3 insertions(+), 40 deletions(-) diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 6d6cb978f..c15c59875 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -470,7 +470,6 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_CLIENT_disconnect (sc->h->client, GNUNET_NO); sc->h->client = GNUNET_CLIENT_connect ("arm", sc->h->cfg); GNUNET_assert (NULL != sc->h->client); - GNUNET_CLIENT_ignore_shutdown (sc->h->client, GNUNET_YES); if (sc->callback != NULL) sc->callback (sc->cls, GNUNET_SYSERR); GNUNET_free (sc); @@ -618,7 +617,6 @@ GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, const char *service_name, } LOG (GNUNET_ERROR_TYPE_DEBUG, "arm_api, GNUNET_CLIENT_connect returned non-NULL\n"); - GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES); h->client = client; } LOG (GNUNET_ERROR_TYPE_DEBUG, "arm_api, h->client non-NULL\n"); @@ -673,7 +671,6 @@ GNUNET_ARM_stop_service (struct GNUNET_ARM_Handle *h, const char *service_name, cb (cb_cls, GNUNET_SYSERR); return; } - GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES); h->client = client; } if (0 == strcasecmp ("arm", service_name)) diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c index ec2f4545d..3ff4d284f 100644 --- a/src/arm/test_exponential_backoff.c +++ b/src/arm/test_exponential_backoff.c @@ -188,7 +188,7 @@ write_shutdown (void *cls, size_t size, void *buf) if (size < sizeof (struct GNUNET_MessageHeader)) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Failed to transmit shutdown request to client.\n")); shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_SYSERR); GNUNET_CLIENT_disconnect (shutdown_ctx->sock, GNUNET_NO); diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index a96215886..60fa938c8 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h @@ -58,18 +58,6 @@ GNUNET_CLIENT_connect (const char *service_name, const struct GNUNET_CONFIGURATION_Handle *cfg); -/** - * Configure this connection to ignore shutdown signals. - * - * @param h client handle - * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default - */ -void -GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, - int do_ignore); - - - /** * Destroy connection with the service. This will automatically * cancel any pending "receive" request (however, the handler will diff --git a/src/util/client.c b/src/util/client.c index 5d5387ef9..d2f347947 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -241,11 +241,6 @@ struct GNUNET_CLIENT_Connection */ int in_receive; - /** - * Are we ignoring shutdown signals? - */ - int ignore_shutdown; - /** * How often have we tried to connect? */ @@ -381,22 +376,6 @@ GNUNET_CLIENT_connect (const char *service_name, } -/** - * Configure this connection to ignore shutdown signals. - * - * @param h client handle - * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default - */ -void -GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, - int do_ignore) -{ - h->ignore_shutdown = do_ignore; - if (h->sock != NULL) - GNUNET_CONNECTION_ignore_shutdown (h->sock, do_ignore); -} - - /** * Destroy connection with the service. This will automatically * cancel any pending "receive" request (however, the handler will @@ -960,8 +939,6 @@ client_delayed_retry (void *cls, GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); return; } - GNUNET_CONNECTION_ignore_shutdown (th->sock->sock, - th->sock->ignore_shutdown); th->th = GNUNET_CONNECTION_notify_transmit_ready (th->sock->sock, th->size, GNUNET_TIME_absolute_get_remaining diff --git a/src/util/connection.c b/src/util/connection.c index 4beafa3f3..cd0035a8f 100644 --- a/src/util/connection.c +++ b/src/util/connection.c @@ -1495,7 +1495,8 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_assert (sock->nth.timeout_task == GNUNET_SCHEDULER_NO_TASK); if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { - if (sock->ignore_shutdown == GNUNET_YES) + if ( (sock->ignore_shutdown == GNUNET_YES) && + (NULL != sock->sock) ) goto SCHEDULE_WRITE; /* ignore shutdown, go again immediately */ #if DEBUG_CONNECTION LOG (GNUNET_ERROR_TYPE_DEBUG, -- cgit v1.2.3