Initialize curl globally to allow concurrent access.

This commit is contained in:
Kishore Nallan 2018-08-15 06:33:06 -04:00
parent ad017b46a4
commit b21e88f2f9
2 changed files with 6 additions and 1 deletions

View File

@ -53,8 +53,8 @@ void HttpServer::on_accept(h2o_socket_t *listener, const char *err) {
}
int HttpServer::setup_ssl(const char *cert_file, const char *key_file) {
SSL_load_error_strings();
SSL_library_init();
SSL_load_error_strings();
accept_ctx->ssl_ctx = SSL_CTX_new(SSLv23_server_method());

View File

@ -1,5 +1,6 @@
#include "core_api.h"
#include "typesense_server_utils.h"
#include <curl/curl.h>
HttpServer* server;
@ -88,6 +89,8 @@ int run_server(cmdline::parser & options, void (*master_server_routes)(), void (
return 1;
}
curl_global_init(CURL_GLOBAL_SSL);
server = new HttpServer(
options.get<std::string>("listen-address"),
options.get<uint32_t>("listen-port"),
@ -124,6 +127,8 @@ int run_server(cmdline::parser & options, void (*master_server_routes)(), void (
int ret_code = server->run();
curl_global_cleanup();
// we are out of the event loop here
delete server;
CollectionManager::get_instance().dispose();