Compare commits
3 Commits
d8556d4df1
...
22cec5fcc3
| Author | SHA1 | Date |
|---|---|---|
|
|
22cec5fcc3 | |
|
|
e4a9fccddb | |
|
|
5477593ce8 |
|
|
@ -166,7 +166,7 @@ static ConnectionManager *find_manager(ConnectionPool *cp,
|
||||||
memcpy(cm->key.str, key->str, key->len + 1);
|
memcpy(cm->key.str, key->str, key->len + 1);
|
||||||
cm->key.len = key->len;
|
cm->key.len = key->len;
|
||||||
|
|
||||||
//add to chain
|
//add to manager chain
|
||||||
cm->next = bucket->head;
|
cm->next = bucket->head;
|
||||||
bucket->head = cm;
|
bucket->head = cm;
|
||||||
return cm;
|
return cm;
|
||||||
|
|
@ -297,17 +297,21 @@ int conn_pool_init_ex1(ConnectionPool *cp, const int connect_timeout,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extra_params != NULL) {
|
if (extra_params != NULL && extra_params->rdma.pd != NULL) {
|
||||||
extra_connection_size = G_RDMA_CONNECTION_CALLBACKS.
|
extra_connection_size = G_RDMA_CONNECTION_CALLBACKS.
|
||||||
get_connection_size();
|
get_connection_size();
|
||||||
obj_init_func = (fast_mblock_object_init_func)node_init_for_rdma;
|
obj_init_func = (fast_mblock_object_init_func)node_init_for_rdma;
|
||||||
cp->extra_params = *extra_params;
|
cp->extra_params = *extra_params;
|
||||||
} else {
|
} else {
|
||||||
extra_connection_size = 0;
|
extra_connection_size = 0;
|
||||||
cp->extra_params.tls.enabled = false;
|
if (extra_params != NULL) {
|
||||||
cp->extra_params.tls.htable_capacity = 163;
|
cp->extra_params = *extra_params;
|
||||||
cp->extra_params.rdma.buffer_size = 0;
|
} else {
|
||||||
cp->extra_params.rdma.pd = NULL;
|
cp->extra_params.tls.enabled = false;
|
||||||
|
cp->extra_params.tls.htable_capacity = 163;
|
||||||
|
cp->extra_params.rdma.buffer_size = 0;
|
||||||
|
cp->extra_params.rdma.pd = NULL;
|
||||||
|
}
|
||||||
obj_init_func = (fast_mblock_object_init_func)node_init_for_socket;
|
obj_init_func = (fast_mblock_object_init_func)node_init_for_socket;
|
||||||
}
|
}
|
||||||
if ((result=fast_mblock_init_ex1(&cp->node_allocator, "cpool-node",
|
if ((result=fast_mblock_init_ex1(&cp->node_allocator, "cpool-node",
|
||||||
|
|
@ -730,6 +734,7 @@ ConnectionInfo *conn_pool_get_connection_ex(ConnectionPool *cp,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add to thread local hashtable
|
||||||
node = (ConnectionNode *)((char *)ci - sizeof(ConnectionNode));
|
node = (ConnectionNode *)((char *)ci - sizeof(ConnectionNode));
|
||||||
node->next = *bucket;
|
node->next = *bucket;
|
||||||
*bucket = node;
|
*bucket = node;
|
||||||
|
|
@ -762,6 +767,8 @@ int conn_pool_close_connection_ex(ConnectionPool *cp,
|
||||||
|
|
||||||
htable = pthread_getspecific(cp->tls_key);
|
htable = pthread_getspecific(cp->tls_key);
|
||||||
if (htable == NULL) {
|
if (htable == NULL) {
|
||||||
|
logError("file: "__FILE__", line: %d, "
|
||||||
|
"the thread local key NOT exist!", __LINE__);
|
||||||
return close_connection(cp, conn, &key, hash_code, bForce);
|
return close_connection(cp, conn, &key, hash_code, bForce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -791,6 +798,10 @@ int conn_pool_close_connection_ex(ConnectionPool *cp,
|
||||||
} else {
|
} else {
|
||||||
previous->next = node->next;
|
previous->next = node->next;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logError("file: "__FILE__", line: %d, "
|
||||||
|
"%.*s NOT in the thread local hashtable!",
|
||||||
|
__LINE__, key.len, key.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
return close_connection(cp, conn, &key, hash_code, bForce);
|
return close_connection(cp, conn, &key, hash_code, bForce);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue