diff options
author | zhenwei pi <pizhenwei@bytedance.com> | 2022-06-14 19:17:28 +0800 |
---|---|---|
committer | zhenwei pi <pizhenwei@bytedance.com> | 2022-08-22 15:11:25 +0800 |
commit | c4c02f80365e5f7a82efa6a4d4f247503f54a5d8 (patch) | |
tree | 66ad91caccc6597d54adae41551a1dce3907a5ce /src/connection.c | |
parent | 709b55b09dee2d22ae306d00b2c9ead1d382c044 (diff) | |
download | redis-c4c02f80365e5f7a82efa6a4d4f247503f54a5d8.tar.gz |
Introduce TLS specified APIs
Introduce .get_peer_cert, .get_ctx and .get_client_ctx for TLS, also
hide redis_tls_ctx & redis_tls_client_ctx.
Then outside could access the variables by connection API only:
- redis_tls_ctx -> connTypeGetCtx(CONN_TYPE_TLS)
- redis_tls_client_ctx -> connTypeGetClientCtx(CONN_TYPE_TLS)
Also remove connTLSGetPeerCert(), use connGetPeerCert() instead.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Diffstat (limited to 'src/connection.c')
-rw-r--r-- | src/connection.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/connection.c b/src/connection.c index 7cf5ebf77..e28257fab 100644 --- a/src/connection.c +++ b/src/connection.c @@ -132,3 +132,23 @@ int connTypeProcessPendingData(void) { return ret; } + +void *connTypeGetCtx(int type) { + ConnectionType *ct = connectionByType(type); + + if (ct && ct->get_ctx) { + return ct->get_ctx(); + } + + return NULL; +} + +void *connTypeGetClientCtx(int type) { + ConnectionType *ct = connectionByType(type); + + if (ct && ct->get_client_ctx) { + return ct->get_client_ctx(); + } + + return NULL; +} |