From bc3a65ee194e6e73c1d50e153d1c29178979b9fd Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Thu, 7 Sep 2023 09:34:45 +0800 Subject: [PATCH] add function fc_server_get_group_by_index --- src/connection_pool.h | 3 ++- src/server_id_func.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/connection_pool.h b/src/connection_pool.h index 72113b3..fa8deed 100644 --- a/src/connection_pool.h +++ b/src/connection_pool.h @@ -42,7 +42,8 @@ extern "C" { typedef enum { fc_comm_type_sock = 0, - fc_comm_type_rdma + fc_comm_type_rdma, + fc_comm_type_both } FCCommunicationType; typedef struct { diff --git a/src/server_id_func.h b/src/server_id_func.h index 08dd544..2355e90 100644 --- a/src/server_id_func.h +++ b/src/server_id_func.h @@ -141,6 +141,16 @@ static inline FCServerInfo *fc_server_get_by_ip_port(FCServerConfig *ctx, FCServerGroupInfo *fc_server_get_group_by_name(FCServerConfig *ctx, const string_t *group_name); +static inline FCServerGroupInfo *fc_server_get_group_by_index( + FCServerConfig *ctx, const int index) +{ + if (index < 0 || index >= ctx->group_array.count) { + return NULL; + } + + return ctx->group_array.groups + index; +} + static inline int fc_server_get_group_index_ex(FCServerConfig *ctx, const string_t *group_name) {