mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
use new config system
This commit is contained in:
parent
48c96d0928
commit
381477af9f
@ -25,105 +25,120 @@
|
||||
ConfigureDef(config_downloader);
|
||||
NotifyCategoryDef(downloader, "");
|
||||
|
||||
// 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)
|
||||
const int downloader_disk_write_frequency =
|
||||
config_downloader.GetInt("downloader-disk-write-frequency", 4);
|
||||
ConfigVariableInt downloader_disk_write_frequency
|
||||
("downloader-disk-write-frequency", 4,
|
||||
"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)");
|
||||
|
||||
// We'd like this to be about 1 second worth of download assuming a
|
||||
// 28.8Kb connection (28.8Kb / 8 = 3600 bytes per second).
|
||||
const int downloader_byte_rate =
|
||||
config_downloader.GetInt("downloader-byte-rate", 3600);
|
||||
ConfigVariableInt downloader_byte_rate
|
||||
("downloader-byte-rate", 3600,
|
||||
"We'd like this to be about 1 second worth of download assuming a "
|
||||
"28.8Kb connection (28.8Kb / 8 = 3600 bytes per second).");
|
||||
|
||||
// Frequency of download chunk requests in seconds (or fractions of)
|
||||
// (Estimated 200 msec round-trip to server).
|
||||
const float downloader_frequency =
|
||||
config_downloader.GetFloat("downloader-frequency", 0.2);
|
||||
ConfigVariableDouble downloader_frequency
|
||||
("downloader-frequency", 0.2,
|
||||
"Frequency of download chunk requests in seconds (or fractions of) "
|
||||
"(Estimated 200 msec round-trip to server).");
|
||||
|
||||
const int downloader_timeout =
|
||||
config_downloader.GetInt("downloader-timeout", 15);
|
||||
ConfigVariableInt downloader_timeout
|
||||
("downloader-timeout", 15);
|
||||
|
||||
const int downloader_timeout_retries =
|
||||
config_downloader.GetInt("downloader-timeout-retries", 5);
|
||||
ConfigVariableInt downloader_timeout_retries
|
||||
("downloader-timeout-retries", 5);
|
||||
|
||||
const int decompressor_buffer_size =
|
||||
config_downloader.GetInt("decompressor-buffer-size", 4096);
|
||||
ConfigVariableInt decompressor_buffer_size
|
||||
("decompressor-buffer-size", 4096);
|
||||
|
||||
const float decompressor_frequency =
|
||||
config_downloader.GetFloat("decompressor-frequency", 0.2);
|
||||
ConfigVariableDouble decompressor_frequency
|
||||
("decompressor-frequency", 0.2);
|
||||
|
||||
const int extractor_buffer_size =
|
||||
config_downloader.GetInt("extractor-buffer-size", 4096);
|
||||
ConfigVariableInt extractor_buffer_size
|
||||
("extractor-buffer-size", 4096);
|
||||
|
||||
const float extractor_frequency =
|
||||
config_downloader.GetFloat("extractor-frequency", 0.2);
|
||||
ConfigVariableDouble extractor_frequency
|
||||
("extractor-frequency", 0.2);
|
||||
|
||||
const int patcher_buffer_size =
|
||||
config_downloader.GetInt("patcher-buffer-size", 4096);
|
||||
ConfigVariableInt patcher_buffer_size
|
||||
("patcher-buffer-size", 4096);
|
||||
|
||||
// Configure this true (the default) to compute the SSL random seed
|
||||
// early on in the application (specifically, when the first
|
||||
// HTTPClient is created), or false to defer this until it is actually
|
||||
// needed, causing a delay the first time a https connection is
|
||||
// attempted.
|
||||
const bool early_random_seed =
|
||||
config_downloader.GetBool("early-random-seed", true);
|
||||
ConfigVariableBool early_random_seed
|
||||
("early-random-seed", true,
|
||||
"Configure this true (the default) to compute the SSL random seed "
|
||||
"early on in the application (specifically, when the first "
|
||||
"HTTPClient is created), or false to defer this until it is actually "
|
||||
"needed, causing a delay the first time a https connection is "
|
||||
"attempted.");
|
||||
|
||||
// Configure this true (the default) to insist on verifying all SSL
|
||||
// (e.g. https) servers against a known certificate, or false to allow
|
||||
// an unverified connection. This controls the default behavior; the
|
||||
// specific behavior for a particular HTTPClient can be adjusted at
|
||||
// runtime with set_verify_ssl().
|
||||
const bool verify_ssl =
|
||||
config_downloader.GetBool("verify-ssl", true);
|
||||
ConfigVariableBool verify_ssl
|
||||
("verify-ssl", true,
|
||||
"Configure this true (the default) to insist on verifying all SSL "
|
||||
"(e.g. https) servers against a known certificate, or false to allow "
|
||||
"an unverified connection. This controls the default behavior; the "
|
||||
"specific behavior for a particular HTTPClient can be adjusted at "
|
||||
"runtime with set_verify_ssl().");
|
||||
|
||||
// This is the default value for HTTPClient::set_cipher_list().
|
||||
const string ssl_cipher_list =
|
||||
config_downloader.GetString("ssl-cipher-list", "DEFAULT");
|
||||
ConfigVariableString ssl_cipher_list
|
||||
("ssl-cipher-list", "DEFAULT",
|
||||
"This is the default value for HTTPClient::set_cipher_list().");
|
||||
|
||||
// This specifies the proxy that we will contact for all HTTP
|
||||
// connections that don't specify otherwise.
|
||||
const string http_proxy =
|
||||
config_downloader.GetString("http-proxy", "");
|
||||
const string http_direct_hosts =
|
||||
config_downloader.GetString("http-direct-hosts", "");
|
||||
const bool http_try_all_direct =
|
||||
config_downloader.GetBool("http-try-all-direct", true);
|
||||
const string http_proxy_username =
|
||||
config_downloader.GetString("http-proxy-username", "");
|
||||
const bool http_proxy_tunnel =
|
||||
config_downloader.GetBool("http-proxy-tunnel", false);
|
||||
ConfigVariableString http_proxy
|
||||
("http-proxy", "",
|
||||
"This specifies the default value for HTTPClient::set_proxy_spec(). "
|
||||
"It is a semicolon-delimited list of proxies that we use to contact "
|
||||
"all HTTP hosts that don't specify otherwise. See "
|
||||
"set_proxy_spec() for more information.");
|
||||
ConfigVariableString http_direct_hosts
|
||||
("http-direct-hosts", "",
|
||||
"This specifies the default value for HTTPClient::set_direct_host_spec(). "
|
||||
"It is a semicolon-delimited list of host names that do not require a "
|
||||
"proxy. See set_direct_host_spec() for more information.");
|
||||
ConfigVariableBool http_try_all_direct
|
||||
("http-try-all-direct", true,
|
||||
"This specifies the default value for HTTPClient::set_try_all_direct(). "
|
||||
"If this is true, a direct connection will always be attempted after an "
|
||||
"attempt to connect through a proxy fails.");
|
||||
ConfigVariableString http_proxy_username
|
||||
("http-proxy-username", "",
|
||||
"This specifies a default username:password to pass to the proxy.");
|
||||
ConfigVariableBool http_proxy_tunnel
|
||||
("http-proxy-tunnel", false,
|
||||
"This specifies the default value for HTTPChannel::set_proxy_tunnel(). "
|
||||
"If this is true, we will tunnel through a proxy for all connections, "
|
||||
"instead of asking the proxy to serve documents normally.");
|
||||
|
||||
// This is the default amount of time to wait for a TCP/IP connection
|
||||
// to be established, in seconds.
|
||||
const double http_connect_timeout =
|
||||
config_downloader.GetDouble("http-connect-timeout", 10.0);
|
||||
ConfigVariableDouble http_connect_timeout
|
||||
("http-connect-timeout", 10.0,
|
||||
"This is the default amount of time to wait for a TCP/IP connection "
|
||||
"to be established, in seconds.");
|
||||
|
||||
// This is the default amount of time to wait for the HTTP server (or
|
||||
// proxy) to finish sending its response to our request, in seconds.
|
||||
// It starts counting after the TCP connection has been established
|
||||
// (http_connect_timeout, above) and the request has been sent.
|
||||
const double http_timeout =
|
||||
config_downloader.GetDouble("http-timeout", 20.0);
|
||||
ConfigVariableDouble http_timeout
|
||||
("http-timeout", 20.0,
|
||||
"This is the default amount of time to wait for the HTTP server (or "
|
||||
"proxy) to finish sending its response to our request, in seconds. "
|
||||
"It starts counting after the TCP connection has been established "
|
||||
"(http_connect_timeout, above) and the request has been sent.");
|
||||
|
||||
// This is the maximum number of times to try reconnecting to the
|
||||
// server on any one document attempt. This is just a failsafe to
|
||||
// prevent the code from attempting runaway connections; this limit
|
||||
// should never be reached in practice.
|
||||
const int http_max_connect_count =
|
||||
config_downloader.GetInt("http-max-connect-count", 10);
|
||||
ConfigVariableInt http_max_connect_count
|
||||
("http-max-connect-count", 10,
|
||||
"This is the maximum number of times to try reconnecting to the "
|
||||
"server on any one document attempt. This is just a failsafe to "
|
||||
"prevent the code from attempting runaway connections; this limit "
|
||||
"should never be reached in practice.");
|
||||
|
||||
// These provide a default client certificate to offer up should an
|
||||
// SSL server demand one. The files references a PEM-formatted file
|
||||
// that includes a public and private key specification. A
|
||||
// connection-specific certificate may also be specified at runtime on
|
||||
// the HTTPClient object, but this will require having a different
|
||||
// HTTPClient object for each differently-certificated connection.
|
||||
const Filename http_client_certificate_filename =
|
||||
Filename::expand_from(config_downloader.GetString("http-client-certificate-filename", ""));
|
||||
const string http_client_certificate_passphrase =
|
||||
config_downloader.GetString("http-client-certificate-passphrase", "");
|
||||
ConfigVariableFilename http_client_certificate_filename
|
||||
("http-client-certificate-filename", "",
|
||||
"This provides a default client certificate to offer up should an "
|
||||
"SSL server demand one. The file names a PEM-formatted file "
|
||||
"that includes a public and private key specification. A "
|
||||
"connection-specific certificate may also be specified at runtime on "
|
||||
"the HTTPClient object, but this will require having a different "
|
||||
"HTTPClient object for each differently-certificated connection.");
|
||||
|
||||
ConfigVariableString http_client_certificate_passphrase
|
||||
("http-client-certificate-passphrase", "",
|
||||
"This specifies the passphrase to use to decode the certificate named "
|
||||
"by http-client-certificate-filename.");
|
||||
|
||||
ConfigureFn(config_downloader) {
|
||||
#ifdef HAVE_SSL
|
||||
|
@ -22,36 +22,41 @@
|
||||
#include "pandabase.h"
|
||||
#include "notifyCategoryProxy.h"
|
||||
#include "dconfig.h"
|
||||
#include "configVariableInt.h"
|
||||
#include "configVariableDouble.h"
|
||||
#include "configVariableBool.h"
|
||||
#include "configVariableString.h"
|
||||
#include "configVariableFilename.h"
|
||||
|
||||
ConfigureDecl(config_downloader, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
|
||||
NotifyCategoryDecl(downloader, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
|
||||
|
||||
extern const int downloader_disk_write_frequency;
|
||||
extern const int downloader_byte_rate;
|
||||
extern const float downloader_frequency;
|
||||
extern const int downloader_timeout;
|
||||
extern const int downloader_timeout_retries;
|
||||
extern ConfigVariableInt downloader_disk_write_frequency;
|
||||
extern ConfigVariableInt downloader_byte_rate;
|
||||
extern ConfigVariableDouble downloader_frequency;
|
||||
extern ConfigVariableInt downloader_timeout;
|
||||
extern ConfigVariableInt downloader_timeout_retries;
|
||||
|
||||
extern const int decompressor_buffer_size;
|
||||
extern const float decompressor_frequency;
|
||||
extern ConfigVariableInt decompressor_buffer_size;
|
||||
extern ConfigVariableDouble decompressor_frequency;
|
||||
|
||||
extern const int extractor_buffer_size;
|
||||
extern const float extractor_frequency;
|
||||
extern ConfigVariableInt extractor_buffer_size;
|
||||
extern ConfigVariableDouble extractor_frequency;
|
||||
|
||||
extern const int patcher_buffer_size;
|
||||
extern ConfigVariableInt patcher_buffer_size;
|
||||
|
||||
extern const bool early_random_seed;
|
||||
extern const bool verify_ssl;
|
||||
extern const string ssl_cipher_list;
|
||||
extern const string http_proxy;
|
||||
extern const string http_direct_hosts;
|
||||
extern const bool http_try_all_direct;
|
||||
extern const string http_proxy_username;
|
||||
extern const bool http_proxy_tunnel;
|
||||
extern const double http_connect_timeout;
|
||||
extern const double http_timeout;
|
||||
extern const int http_max_connect_count;
|
||||
extern const Filename http_client_certificate_filename;
|
||||
extern const string http_client_certificate_passphrase;
|
||||
extern ConfigVariableBool early_random_seed;
|
||||
extern ConfigVariableBool verify_ssl;
|
||||
extern ConfigVariableString ssl_cipher_list;
|
||||
extern ConfigVariableString http_proxy;
|
||||
extern ConfigVariableString http_direct_hosts;
|
||||
extern ConfigVariableBool http_try_all_direct;
|
||||
extern ConfigVariableString http_proxy_username;
|
||||
extern ConfigVariableBool http_proxy_tunnel;
|
||||
extern ConfigVariableDouble http_connect_timeout;
|
||||
extern ConfigVariableDouble http_timeout;
|
||||
extern ConfigVariableInt http_max_connect_count;
|
||||
extern ConfigVariableFilename http_client_certificate_filename;
|
||||
extern ConfigVariableString http_client_certificate_passphrase;
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user