diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-26 22:13:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-26 22:13:01 +0000 |
commit | 64d3e46cfb99a711e500fa1f114e7c44bdf10040 (patch) | |
tree | 83093d92761d5c1b8b2fded713adaa19af29274c /src/dht/dht_api.c | |
parent | ef6f05f63769263a5201636c4b7f71eaa455cdf3 (diff) | |
download | gnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.tar.gz gnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.zip |
-bugfixes, code cleanup
Diffstat (limited to 'src/dht/dht_api.c')
-rw-r--r-- | src/dht/dht_api.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index 023ffe60d..0905486d1 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -401,13 +401,7 @@ try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
401 | struct GNUNET_DHT_Handle *handle = cls; | 401 | struct GNUNET_DHT_Handle *handle = cls; |
402 | 402 | ||
403 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Reconnecting with DHT %p\n", handle); | 403 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Reconnecting with DHT %p\n", handle); |
404 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 404 | handle->retry_time = GNUNET_TIME_STD_BACKOFF (handle->retry_time); |
405 | if (handle->retry_time.rel_value < GNUNET_CONSTANTS_SERVICE_RETRY.rel_value) | ||
406 | handle->retry_time = GNUNET_CONSTANTS_SERVICE_RETRY; | ||
407 | else | ||
408 | handle->retry_time = GNUNET_TIME_relative_multiply (handle->retry_time, 2); | ||
409 | if (handle->retry_time.rel_value > GNUNET_CONSTANTS_SERVICE_TIMEOUT.rel_value) | ||
410 | handle->retry_time = GNUNET_CONSTANTS_SERVICE_TIMEOUT; | ||
411 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 405 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
412 | if (GNUNET_YES != try_connect (handle)) | 406 | if (GNUNET_YES != try_connect (handle)) |
413 | { | 407 | { |
@@ -438,8 +432,9 @@ do_disconnect (struct GNUNET_DHT_Handle *handle) | |||
438 | GNUNET_CLIENT_notify_transmit_ready_cancel (handle->th); | 432 | GNUNET_CLIENT_notify_transmit_ready_cancel (handle->th); |
439 | handle->th = NULL; | 433 | handle->th = NULL; |
440 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 434 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
441 | "Disconnecting from DHT service, will try to reconnect in %llu ms\n", | 435 | "Disconnecting from DHT service, will try to reconnect in %s\n", |
442 | (unsigned long long) handle->retry_time.rel_value); | 436 | GNUNET_STRINGS_relative_time_to_string (handle->retry_time, |
437 | GNUNET_YES)); | ||
443 | GNUNET_CLIENT_disconnect (handle->client); | 438 | GNUNET_CLIENT_disconnect (handle->client); |
444 | handle->client = NULL; | 439 | handle->client = NULL; |
445 | 440 | ||