Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Fix catch up error on https.

kishorenc1ca39459ebac
diff --git a/include/http_server.h b/include/http_server.h
index bf209b32..0a30e4b5 100644
--- a/include/http_server.h
+++ b/include/http_server.h
@@ -58,8 +58,6 @@ private:
bool exit_loop = false;
- bool ssl_enabled = false;
-
private:
std::string version;
@@ -173,8 +171,4 @@ public:
static void on_deferred_process_request(h2o_timer_t *entry);
void defer_processing(http_req& req, http_res& res, size_t timeout_ms);
-
- bool is_ssl_enabled() {
- return ssl_enabled;
- }
};
diff --git a/src/http_server.cpp b/src/http_server.cpp
index 590a7511..87a60651 100644
--- a/src/http_server.cpp
+++ b/src/http_server.cpp
@@ -112,7 +112,6 @@ int HttpServer::setup_ssl(const char *cert_file, const char *key_file) {
}
h2o_ssl_register_alpn_protocols(accept_ctx->ssl_ctx, h2o_http2_alpn_protocols);
- ssl_enabled = true;
return 0;
}
diff --git a/src/typesense_server_utils.cpp b/src/typesense_server_utils.cpp
index 1a0b6bca..69574aca 100644
--- a/src/typesense_server_utils.cpp
+++ b/src/typesense_server_utils.cpp
@@ -357,11 +357,13 @@ int run_server(const Config & config, const std::string & version, void (*master
server->on(HttpServer::STREAM_RESPONSE_MESSAGE, HttpServer::on_stream_response_message);
server->on(HttpServer::REQUEST_PROCEED_MESSAGE, HttpServer::on_request_proceed_message);
+ bool ssl_enabled = (!config.get_ssl_cert().empty() && !config.get_ssl_cert_key().empty());
+
// first we start the peering service
ThreadPool thread_pool(32);
ReplicationState replication_state(&store, &thread_pool, server->get_message_dispatcher(),
- server->is_ssl_enabled(), config.get_catch_up_threshold_percentage(),
+ ssl_enabled, config.get_catch_up_threshold_percentage(),
create_init_db_snapshot, quit_raft_service);
std::thread raft_thread([&replication_state, &config, &state_dir]() {