change connection_manager extra pointer
parent
f60fcf0d82
commit
a7a8f5af4b
|
|
@ -447,13 +447,13 @@ static ConnectionInfo *get_leader_connection(SFConnectionManager *cm,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static const struct sf_connection_parameters *get_connection_params(
|
||||
const struct sf_connection_parameters *sf_cm_get_connection_params(
|
||||
SFConnectionManager *cm, ConnectionInfo *conn)
|
||||
{
|
||||
return (SFConnectionParameters *)conn->args;
|
||||
}
|
||||
|
||||
static int validate_connection_callback(ConnectionInfo *conn, void *args)
|
||||
int sf_cm_validate_connection_callback(ConnectionInfo *conn, void *args)
|
||||
{
|
||||
SFConnectionManager *cm;
|
||||
SFResponseInfo response;
|
||||
|
|
@ -502,7 +502,7 @@ int sf_connection_manager_init_ex(SFConnectionManager *cm,
|
|||
if ((result=conn_pool_init_ex1(&cm->cpool, common_cfg->connect_timeout,
|
||||
max_count_per_entry, max_idle_time, socket_domain,
|
||||
htable_init_capacity, connect_done_callback, args,
|
||||
validate_connection_callback, cm,
|
||||
sf_cm_validate_connection_callback, cm,
|
||||
sizeof(SFConnectionParameters))) != 0)
|
||||
{
|
||||
return result;
|
||||
|
|
@ -535,7 +535,7 @@ int sf_connection_manager_init_ex(SFConnectionManager *cm,
|
|||
cm->ops.get_leader_connection = get_leader_connection;
|
||||
cm->ops.release_connection = release_connection;
|
||||
cm->ops.close_connection = close_connection;
|
||||
cm->ops.get_connection_params = get_connection_params;
|
||||
cm->ops.get_connection_params = sf_cm_get_connection_params;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,15 +102,6 @@ typedef struct sf_cm_operations {
|
|||
sf_get_connection_parameters get_connection_params;
|
||||
} SFCMOperations;
|
||||
|
||||
typedef struct sf_cm_simple_extra {
|
||||
/* master connection cache */
|
||||
struct {
|
||||
ConnectionInfo *conn;
|
||||
ConnectionInfo holder;
|
||||
} master_cache;
|
||||
void *args[2];
|
||||
} SFCMSimpleExtra;
|
||||
|
||||
typedef struct sf_connection_manager {
|
||||
short server_group_index;
|
||||
short max_servers_per_group;
|
||||
|
|
@ -124,7 +115,7 @@ typedef struct sf_connection_manager {
|
|||
ConnectionPool cpool;
|
||||
struct fast_mblock_man sptr_array_allocator; //element: SFCMServerPtrArray
|
||||
SFCMOperations ops;
|
||||
SFCMSimpleExtra *extra; //for simple connection manager
|
||||
void *extra; //for simple connection manager
|
||||
} SFConnectionManager;
|
||||
|
||||
int sf_connection_manager_init_ex(SFConnectionManager *cm,
|
||||
|
|
@ -156,6 +147,11 @@ int sf_connection_manager_prepare(SFConnectionManager *cm);
|
|||
//start thread
|
||||
int sf_connection_manager_start(SFConnectionManager *cm);
|
||||
|
||||
int sf_cm_validate_connection_callback(ConnectionInfo *conn, void *args);
|
||||
|
||||
const struct sf_connection_parameters *sf_cm_get_connection_params(
|
||||
SFConnectionManager *cm, ConnectionInfo *conn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue