Browse Source

add early_random_seed

David Rose 23 years ago
parent
commit
77e2dc76d3

+ 8 - 0
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();

+ 2 - 0
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

+ 3 - 1
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;
 }