• zhenwei pi's avatar
    Introduce connection layer framework · 8234a512
    zhenwei pi authored
    
    
    Use connTypeRegister() to register a connection type into redis, and
    query connection by connectionByType() via type.
    
    With this change, we can hide TLS specified methods into connection
    type:
    - void tlsInit(void);
    - void tlsCleanup(void);
    - int tlsConfigure(redisTLSContextConfig *ctx_config);
    - int isTlsConfigured(void);
    
    Merge isTlsConfigured & tlsConfigure, use an argument *reconfigure*
    to distinguish:
       tlsConfigure(&server.tls_ctx_config)
    -> onnTypeConfigure(CONN_TYPE_TLS, &server.tls_ctx_config, 1)
    
       isTlsConfigured() && tlsConfigure(&server.tls_ctx_config)
    -> connTypeConfigure(CONN_TYPE_TLS, &server.tls_ctx_config, 0)
    
    Finally, we can remove USE_OPENSSL from config.c. If redis is built
    without TLS, and still run redis with TLS, then redis reports:
     # Missing implement of connection type 1
     # Failed to configure TLS. Check logs for more info.
    
    The log can be optimised, let's leave it in the future. Maybe we can
    use connection type as a string.
    
    Although uninitialized fields of a static struct are zero, we still
    set them as NULL explicitly in socket.c, let them clear to read & maintain:
        .init = NULL,
        .cleanup = NULL,
        .configure = NULL,
    Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
    8234a512
Makefile 14.9 KB