aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-12-06 13:53:33 +0000
committerChristian Grothoff <christian@grothoff.org>2012-12-06 13:53:33 +0000
commit4127ea5df52dafca5538d2f9b74b0bec0c18bb8d (patch)
tree09ecd26d65c0d5c639df6a8c285b6ccbc06d37ad /src/util
parenteb7221b4ca8db6152240b4f71b35ef7296795532 (diff)
downloadgnunet-4127ea5df52dafca5538d2f9b74b0bec0c18bb8d.tar.gz
gnunet-4127ea5df52dafca5538d2f9b74b0bec0c18bb8d.zip
-improving shutdown behavior
Diffstat (limited to 'src/util')
-rw-r--r--src/util/client.c13
-rw-r--r--src/util/speedup.c5
2 files changed, 14 insertions, 4 deletions
diff --git a/src/util/client.c b/src/util/client.c
index 81c696a7b..69380c9b0 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -943,8 +943,16 @@ client_delayed_retry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
943{ 943{
944 struct GNUNET_CLIENT_TransmitHandle *th = cls; 944 struct GNUNET_CLIENT_TransmitHandle *th = cls;
945 struct GNUNET_TIME_Relative delay; 945 struct GNUNET_TIME_Relative delay;
946 946
947 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 947 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
948 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
949 {
950 /* give up, was shutdown */
951 th->client->th = NULL;
952 th->notify (th->notify_cls, 0, NULL);
953 GNUNET_free (th);
954 return;
955 }
948 th->client->connection = 956 th->client->connection =
949 do_connect (th->client->service_name, th->client->cfg, th->client->attempts++); 957 do_connect (th->client->service_name, th->client->cfg, th->client->attempts++);
950 th->client->first_message = GNUNET_YES; 958 th->client->first_message = GNUNET_YES;
@@ -1006,7 +1014,8 @@ client_notify (void *cls, size_t size, void *buf)
1006 delay = GNUNET_TIME_absolute_get_remaining (th->timeout); 1014 delay = GNUNET_TIME_absolute_get_remaining (th->timeout);
1007 delay.rel_value /= 2; 1015 delay.rel_value /= 2;
1008 if ((GNUNET_YES != th->auto_retry) || (0 == --th->attempts_left) || 1016 if ((GNUNET_YES != th->auto_retry) || (0 == --th->attempts_left) ||
1009 (delay.rel_value < 1)) 1017 (delay.rel_value < 1)||
1018 (0 != (GNUNET_SCHEDULER_get_reason() & GNUNET_SCHEDULER_REASON_SHUTDOWN)))
1010 { 1019 {
1011 LOG (GNUNET_ERROR_TYPE_DEBUG, 1020 LOG (GNUNET_ERROR_TYPE_DEBUG,
1012 "Transmission failed %u times, giving up.\n", 1021 "Transmission failed %u times, giving up.\n",
diff --git a/src/util/speedup.c b/src/util/speedup.c
index 0a005c035..e5f71d063 100644
--- a/src/util/speedup.c
+++ b/src/util/speedup.c
@@ -83,8 +83,9 @@ GNUNET_SPEEDUP_stop_ ( )
83 GNUNET_SCHEDULER_cancel (speedup_task); 83 GNUNET_SCHEDULER_cancel (speedup_task);
84 speedup_task = GNUNET_SCHEDULER_NO_TASK; 84 speedup_task = GNUNET_SCHEDULER_NO_TASK;
85 } 85 }
86 LOG (GNUNET_ERROR_TYPE_DEBUG, 86 if ((0 != interval.rel_value) && (0 != delta.rel_value))
87 "Stopped execution speed up\n"); 87 LOG (GNUNET_ERROR_TYPE_DEBUG,
88 "Stopped execution speed up\n");
88} 89}
89 90
90 91