Skip to content

Commit

Permalink
Cleanup of SSL init function in cluster context
Browse files Browse the repository at this point in the history
Signed-off-by: Björn Svensson <[email protected]>
  • Loading branch information
bjosv committed Sep 23, 2024
1 parent fbbf80e commit 6bb24e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 3 additions & 3 deletions include/valkey/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ extern "C" {

struct hilist;
struct valkeyClusterAsyncContext;
struct valkeySSLContext;

typedef int(adapterAttachFn)(valkeyAsyncContext *, void *);
typedef int(sslInitFn)(valkeyContext *, void *);
typedef void(valkeyClusterCallbackFn)(struct valkeyClusterAsyncContext *,
void *, void *);
typedef struct valkeyClusterNode {
Expand Down Expand Up @@ -116,8 +116,8 @@ typedef struct valkeyClusterContext {
int retry_count; /* Current number of failing attempts */
int need_update_route; /* Indicator for valkeyClusterReset() (Pipel.) */

void *ssl; /* Pointer to a valkeySSLContext when using SSL/TLS. */
sslInitFn *ssl_init_fn; /* Func ptr for SSL context initiation */
void *ssl; /* Pointer to a valkeySSLContext when using SSL/TLS. */
int (*ssl_init_fn)(struct valkeyContext *, struct valkeySSLContext *);

void (*on_connect)(const struct valkeyContext *c, int status);
void (*event_callback)(const struct valkeyClusterContext *cc, int event,
Expand Down
7 changes: 1 addition & 6 deletions src/cluster_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,14 @@
*/
#include "cluster_ssl.h"

static int valkeyClusterInitiateSSLWithContext(valkeyContext *c,
void *valkey_ssl_ctx) {
return valkeyInitiateSSLWithContext(c, valkey_ssl_ctx);
}

int valkeyClusterSetOptionEnableSSL(valkeyClusterContext *cc,
valkeySSLContext *ssl) {
if (cc == NULL || ssl == NULL) {
return VALKEY_ERR;
}

cc->ssl = ssl;
cc->ssl_init_fn = &valkeyClusterInitiateSSLWithContext;
cc->ssl_init_fn = &valkeyInitiateSSLWithContext;

return VALKEY_OK;
}

0 comments on commit 6bb24e5

Please sign in to comment.