diff options
author | zhenwei pi <pizhenwei@bytedance.com> | 2022-08-22 15:15:37 +0800 |
---|---|---|
committer | zhenwei pi <pizhenwei@bytedance.com> | 2022-08-22 15:15:37 +0800 |
commit | 45617385e72eb814c6548064835cf19cdf466a5b (patch) | |
tree | 26bc3790c2e8626e4c3c74a5aa3c214a389c4d92 /src/sentinel.c | |
parent | eb94d6d36dec7323af5fb89a5899506d5c07adb1 (diff) | |
download | redis-45617385e72eb814c6548064835cf19cdf466a5b.tar.gz |
Use connection name of string
Suggested by Oran, use an array to store all the connection types
instead of a linked list, and use connection name of string. The index
of a connection is dynamically allocated.
Currently we support max 8 connection types, include:
- tcp
- unix socket
- tls
and RDMA is in the plan, then we have another 4 types to support, it
should be enough in a long time.
Introduce 3 functions to get connection type by a fast path:
- connectionTypeTcp()
- connectionTypeTls()
- connectionTypeUnix()
Note that connectionByType() is designed to use only in unlikely code path.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Diffstat (limited to 'src/sentinel.c')
-rw-r--r-- | src/sentinel.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index f0e3e8609..881f4b909 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2376,8 +2376,8 @@ static int instanceLinkNegotiateTLS(redisAsyncContext *context) { #ifndef USE_OPENSSL (void) context; #else - SSL_CTX *redis_tls_ctx = connTypeGetCtx(CONN_TYPE_TLS); - SSL_CTX *redis_tls_client_ctx = connTypeGetClientCtx(CONN_TYPE_TLS); + SSL_CTX *redis_tls_ctx = connTypeGetCtx(connectionTypeTls()); + SSL_CTX *redis_tls_client_ctx = connTypeGetClientCtx(connectionTypeTls()); if (!redis_tls_ctx) return C_ERR; SSL *ssl = SSL_new(redis_tls_client_ctx ? redis_tls_client_ctx : redis_tls_ctx); |