diff --git a/src/connection_pool.h b/src/connection_pool.h index b38f33b..c280980 100644 --- a/src/connection_pool.h +++ b/src/connection_pool.h @@ -460,6 +460,11 @@ static inline ConnectionInfo *conn_pool_alloc_connection( extra_data_size, extra_params, err_no); } +static inline void conn_pool_free_connection(ConnectionInfo *conn) +{ + free(conn); +} + int conn_pool_set_rdma_extra_params(ConnectionExtraParams *extra_params, struct fc_server_config *server_cfg, const int server_group_index); diff --git a/src/server_id_func.h b/src/server_id_func.h index 00c7ca5..6a8e489 100644 --- a/src/server_id_func.h +++ b/src/server_id_func.h @@ -251,6 +251,17 @@ int fc_server_make_connection_ex(FCAddressPtrArray *addr_array, fc_server_make_connection_ex(addr_array, conn, \ service_name, connect_timeout, NULL, true) +static inline void fc_server_close_connection(ConnectionInfo *conn) +{ + G_COMMON_CONNECTION_CALLBACKS[conn->comm_type].close_connection(conn); +} + +static inline void fc_server_destroy_connection(ConnectionInfo *conn) +{ + fc_server_close_connection(conn); + conn_pool_free_connection(conn); +} + struct ibv_pd *fc_alloc_rdma_pd(fc_alloc_pd_callback alloc_pd, FCAddressPtrArray *address_array, int *result);