download-throttle config var

This commit is contained in:
David Rose 2009-12-28 19:15:48 +00:00
parent 59e6a8a444
commit 5455b869b2
3 changed files with 14 additions and 11 deletions

View File

@ -23,16 +23,19 @@
ConfigureDef(config_downloader);
NotifyCategoryDef(downloader, "");
ConfigVariableInt downloader_disk_write_frequency
("downloader-disk-write-frequency", 4,
PRC_DESC("How often we write to disk is determined by this ratio which is "
"relative to the downloader-byte-rate (e.g. if disk-write-ratio is 4, "
"we will write every 4 seconds if the frequency is 0.2)"));
ConfigVariableInt downloader_byte_rate
("downloader-byte-rate", 3600,
PRC_DESC("We'd like this to be about 1 second worth of download assuming a "
"28.8Kb connection (28.8Kb / 8 = 3600 bytes per second)."));
("downloader-byte-rate", 500000,
PRC_DESC("Specifies the default max bytes per second of throughput that is "
"supported by any HTTP connections with download-throttle enabled. "
"This may also be set on a per-channel basis with "
"HTTPChannel::set_max_bytes_per_second(). It has no effect unless "
"download-throttle (or HTTPChannel::set_download_throttle) is true."));
ConfigVariableBool download_throttle
("download-throttle", false,
PRC_DESC("When this is true, all HTTP channels will be bandwidth-limited "
"so as not to consume more than downloader-byte-rate bytes per "
"second."));
ConfigVariableDouble downloader_frequency
("downloader-frequency", 0.2,

View File

@ -28,8 +28,8 @@
ConfigureDecl(config_downloader, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
NotifyCategoryDecl(downloader, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
extern ConfigVariableInt downloader_disk_write_frequency;
extern ConfigVariableInt downloader_byte_rate;
extern ConfigVariableBool download_throttle;
extern ConfigVariableDouble downloader_frequency;
extern ConfigVariableInt downloader_timeout;
extern ConfigVariableInt downloader_timeout_retries;

View File

@ -53,7 +53,7 @@ HTTPChannel(HTTPClient *client) :
_skip_body_size = http_skip_body_size;
_idle_timeout = http_idle_timeout;
_blocking_connect = false;
_download_throttle = false;
_download_throttle = download_throttle;
_max_bytes_per_second = downloader_byte_rate;
_seconds_per_update = downloader_frequency;
_max_updates_per_second = 1.0f / _seconds_per_update;