From 77e2dc76d32e79c5f8cb14566789d4f66fe10c33 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 30 Sep 2002 22:04:21 +0000 Subject: [PATCH] add early_random_seed --- panda/src/downloader/config_downloader.cxx | 8 ++++++++ panda/src/downloader/config_downloader.h | 2 ++ panda/src/downloader/httpClient.cxx | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/panda/src/downloader/config_downloader.cxx b/panda/src/downloader/config_downloader.cxx index ba5ca4045a..1dd81ce5f7 100644 --- a/panda/src/downloader/config_downloader.cxx +++ b/panda/src/downloader/config_downloader.cxx @@ -62,6 +62,14 @@ const float extractor_frequency = const int patcher_buffer_size = config_downloader.GetInt("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", 1); + ConfigureFn(config_downloader) { #ifdef HAVE_SSL HTTPDocument::init_type(); diff --git a/panda/src/downloader/config_downloader.h b/panda/src/downloader/config_downloader.h index cc7ead0126..c2c93878e9 100644 --- a/panda/src/downloader/config_downloader.h +++ b/panda/src/downloader/config_downloader.h @@ -38,4 +38,6 @@ extern const float extractor_frequency; extern const int patcher_buffer_size; +extern const bool early_random_seed; + #endif diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index eb91bcadf8..39d4405007 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/panda/src/downloader/httpClient.cxx @@ -158,7 +158,9 @@ initialize_ssl() { // Call RAND_status() here to force the random number generator to // initialize early. - RAND_status(); + if (early_random_seed) { + RAND_status(); + } _ssl_initialized = true; }