diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-05 07:55:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-05 07:55:28 +0000 |
commit | 17276ed4b30d150d540e8ec270ccf96be6f5ee29 (patch) | |
tree | 57d18271fec19876c4842258d96af521ffa3d5bb /src/fs/fs_download.c | |
parent | 07eb9c1e6c98769306b16a31f7ad9d3b454b0e2e (diff) | |
download | gnunet-17276ed4b30d150d540e8ec270ccf96be6f5ee29.tar.gz gnunet-17276ed4b30d150d540e8ec270ccf96be6f5ee29.zip |
-trying to fix bratao's 100% CPU bug, even though I wonder if this can really be it, as there was a 1s delay already; anyway, exponential back-off is better
Diffstat (limited to 'src/fs/fs_download.c')
-rw-r--r-- | src/fs/fs_download.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 3434a9553..e9839cc2d 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -1436,10 +1436,18 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc) | |||
1436 | dc->in_receive = GNUNET_NO; | 1436 | dc->in_receive = GNUNET_NO; |
1437 | dc->client = NULL; | 1437 | dc->client = NULL; |
1438 | } | 1438 | } |
1439 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will try to reconnect in 1s\n"); | 1439 | if (0 == dc->reconnect_backoff.rel_value) |
1440 | dc->reconnect_backoff = GNUNET_TIME_UNIT_MILLISECONDS; | ||
1441 | else | ||
1442 | dc->reconnect_backoff = GNUNET_TIME_relative_min (GNUNET_TIME_relative_multiply (dc->reconnect_backoff, 2), | ||
1443 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10)); | ||
1444 | |||
1445 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will try to reconnect in %s\n", | ||
1446 | GNUNET_STRINGS_relative_time_to_string (dc->reconnect_backoff, GNUNET_YES)); | ||
1440 | dc->task = | 1447 | dc->task = |
1441 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_reconnect, | 1448 | GNUNET_SCHEDULER_add_delayed (dc->reconnect_backoff, |
1442 | dc); | 1449 | &do_reconnect, |
1450 | dc); | ||
1443 | } | 1451 | } |
1444 | 1452 | ||
1445 | 1453 | ||