소스 검색

add early_random_seed

David Rose 23 년 전
부모
커밋
77e2dc76d3
3개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 0
      panda/src/downloader/config_downloader.cxx
  2. 2 0
      panda/src/downloader/config_downloader.h
  3. 3 1
      panda/src/downloader/httpClient.cxx

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