aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-07 18:29:42 +0000
committerChristian Grothoff <christian@grothoff.org>2015-03-07 18:29:42 +0000
commit6da7b6a2dc5ec3645d5f8bdbd4ab77d6090b823f (patch)
treee2ff0e0068f8d064e4a3f63af5121e18e3aef6dd /src/fs/fs_api.c
parente96f9b7e879d6e6ea44824a89fce59d41435d661 (diff)
fix #3704
Diffstat (limited to 'src/fs/fs_api.c')
-rw-r--r--src/fs/fs_api.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index eb692a93ef..f539c7910f 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -202,6 +202,8 @@ process_job_queue (void *cls,
break;
}
}
+ GNUNET_break (h->active_downloads ==
+ num_downloads_active + num_probes_active);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"PA: %u, PE: %u, PW: %u; DA: %u, DE: %u, DW: %u\n",
num_probes_active,
@@ -210,6 +212,8 @@ process_job_queue (void *cls,
num_downloads_active,
num_downloads_expired,
num_downloads_waiting);
+ GNUNET_break (h->active_downloads + num_probes_active <=
+ h->max_parallel_downloads);
/* calculate start/stop decisions */
if (h->active_downloads + num_downloads_waiting > h->max_parallel_downloads)
{
@@ -225,17 +229,19 @@ process_job_queue (void *cls,
/* start all downloads (we can) */
num_downloads_change = num_downloads_waiting;
/* also start probes if there is room, but use a lower cap of (mpd/4) + 1 */
- if (h->max_parallel_downloads / 2 >= (h->active_downloads + num_downloads_change))
+ if (1 + h->max_parallel_downloads / 4 >= (h->active_downloads + num_downloads_change))
num_probes_change = GNUNET_MIN (num_probes_waiting,
(1 + h->max_parallel_downloads / 4) - (h->active_downloads + num_downloads_change));
else
num_probes_change = 0;
}
-
+ GNUNET_break (num_downloads_change <= num_downloads_waiting);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Changing %d probes and %d downloads\n",
+ "Changing %d probes and %d/%u/%u downloads\n",
num_probes_change,
- num_downloads_change);
+ num_downloads_change,
+ (unsigned int) h->active_downloads,
+ (unsigned int) h->max_parallel_downloads);
/* actually stop probes */
next = h->running_head;
while (NULL != (qe = next))
@@ -289,7 +295,8 @@ process_job_queue (void *cls,
break;
}
}
- GNUNET_break ( (0 == num_downloads_change) || (GNUNET_YES == block_limit_hit) );
+ GNUNET_break ( (0 == num_downloads_change) ||
+ (GNUNET_YES == block_limit_hit) );
GNUNET_break (0 == num_probes_change);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,