CUBRID Engine
latest
|
#include <sys/types.h>
#include <assert.h>
#include <sys/time.h>
#include <unistd.h>
#include <pthread.h>
#include "porting.h"
#include "broker_proxy_conn.h"
#include "shard_proxy_common.h"
#include "shard_shm.h"
Go to the source code of this file.
Functions | |
static void | broker_free_all_proxy_conn_ent (void) |
static T_PROXY_CONN_ENT * | broker_find_proxy_conn_by_fd (SOCKET fd) |
static T_PROXY_CONN_ENT * | broker_find_proxy_conn_by_id (int proxy_id) |
int | broker_set_proxy_fds (fd_set *fds) |
SOCKET | broker_get_readable_proxy_conn (fd_set *fds) |
int | broker_add_proxy_conn (SOCKET fd) |
int | broker_delete_proxy_conn_by_fd (SOCKET fd) |
int | broker_delete_proxy_conn_by_proxy_id (int proxy_id) |
int | broker_register_proxy_conn (SOCKET fd, int proxy_id) |
SOCKET | broker_find_available_proxy (T_SHM_PROXY *shm_proxy_p) |
SOCKET | broker_get_proxy_conn_maxfd (SOCKET proxy_sock_fd) |
int | broker_init_proxy_conn (int max_proxy) |
void | broker_destroy_proxy_conn (void) |
Variables | |
T_PROXY_CONN | broker_Proxy_conn |
pthread_mutex_t | proxy_conn_mutex |
int broker_add_proxy_conn | ( | SOCKET | fd | ) |
Definition at line 158 of file broker_proxy_conn.c.
References assert, t_proxy_conn::cur_num_proxy, t_proxy_conn_ent::fd, t_proxy_conn::max_num_proxy, t_proxy_conn_ent::next, NULL, PROXY_CONN_CONNECTED, t_proxy_conn::proxy_conn_ent, proxy_conn_mutex, t_proxy_conn_ent::proxy_id, PROXY_INVALID_ID, pthread_mutex_lock, pthread_mutex_unlock, and t_proxy_conn_ent::status.
Referenced by proxy_listener_thr_f().
int broker_delete_proxy_conn_by_fd | ( | SOCKET | fd | ) |
Definition at line 201 of file broker_proxy_conn.c.
References assert, t_proxy_conn::cur_num_proxy, t_proxy_conn_ent::fd, FREE_MEM, t_proxy_conn_ent::next, NULL, t_proxy_conn::proxy_conn_ent, proxy_conn_mutex, pthread_mutex_lock, and pthread_mutex_unlock.
Referenced by proxy_listener_thr_f(), and shard_dispatch_thr_f().
int broker_delete_proxy_conn_by_proxy_id | ( | int | proxy_id | ) |
Definition at line 238 of file broker_proxy_conn.c.
References assert, t_proxy_conn::cur_num_proxy, FREE_MEM, t_proxy_conn_ent::next, NULL, t_proxy_conn::proxy_conn_ent, proxy_conn_mutex, t_proxy_conn_ent::proxy_id, PROXY_INVALID_ID, pthread_mutex_lock, and pthread_mutex_unlock.
Referenced by stop_proxy_server().
void broker_destroy_proxy_conn | ( | void | ) |
Definition at line 428 of file broker_proxy_conn.c.
References broker_free_all_proxy_conn_ent(), t_proxy_conn::cur_num_proxy, t_proxy_conn::max_num_proxy, proxy_conn_mutex, pthread_mutex_destroy, pthread_mutex_lock, and pthread_mutex_unlock.
Referenced by main().
SOCKET broker_find_available_proxy | ( | T_SHM_PROXY * | shm_proxy_p | ) |
Definition at line 315 of file broker_proxy_conn.c.
References assert, broker_find_proxy_conn_by_id(), t_proxy_info::cur_client, t_proxy_conn_ent::fd, INVALID_SOCKET, t_proxy_info::max_context, t_proxy_conn::max_num_proxy, NULL, t_shm_proxy::num_proxy, t_proxy_info::pid, PROXY_CONN_AVAILABLE, proxy_conn_mutex, t_proxy_info::proxy_id, proxy_info_p, pthread_mutex_lock, pthread_mutex_unlock, shard_shm_find_proxy_info(), and t_proxy_conn_ent::status.
Referenced by broker_register_proxy_conn(), and shard_dispatch_thr_f().
|
static |
Definition at line 122 of file broker_proxy_conn.c.
References t_proxy_conn_ent::fd, t_proxy_conn_ent::next, NULL, and t_proxy_conn::proxy_conn_ent.
Referenced by broker_register_proxy_conn().
|
static |
Definition at line 140 of file broker_proxy_conn.c.
References t_proxy_conn_ent::next, NULL, t_proxy_conn::proxy_conn_ent, and t_proxy_conn_ent::proxy_id.
Referenced by broker_find_available_proxy().
|
static |
Definition at line 53 of file broker_proxy_conn.c.
References FREE_MEM, t_proxy_conn_ent::next, NULL, and t_proxy_conn::proxy_conn_ent.
Referenced by broker_destroy_proxy_conn().
Definition at line 387 of file broker_proxy_conn.c.
References t_proxy_conn_ent::fd, t_proxy_conn_ent::next, t_proxy_conn::proxy_conn_ent, proxy_conn_mutex, PROXY_CONN_NOT_CONNECTED, proxy_sock_fd, pthread_mutex_lock, pthread_mutex_unlock, and t_proxy_conn_ent::status.
Referenced by proxy_listener_thr_f().
SOCKET broker_get_readable_proxy_conn | ( | fd_set * | fds | ) |
Definition at line 88 of file broker_proxy_conn.c.
References t_proxy_conn_ent::fd, INVALID_SOCKET, t_proxy_conn_ent::next, PROXY_CONN_CONNECTED, t_proxy_conn::proxy_conn_ent, proxy_conn_mutex, pthread_mutex_lock, pthread_mutex_unlock, and t_proxy_conn_ent::status.
Referenced by proxy_listener_thr_f().
int broker_init_proxy_conn | ( | int | max_proxy | ) |
Definition at line 411 of file broker_proxy_conn.c.
References t_proxy_conn::cur_num_proxy, t_proxy_conn::max_num_proxy, NULL, t_proxy_conn::proxy_conn_ent, proxy_conn_mutex, and pthread_mutex_init.
Referenced by main().
int broker_register_proxy_conn | ( | SOCKET | fd, |
int | proxy_id | ||
) |
Definition at line 281 of file broker_proxy_conn.c.
References assert, broker_find_available_proxy(), broker_find_proxy_conn_by_fd(), NULL, PROXY_CONN_AVAILABLE, proxy_conn_mutex, proxy_id, t_proxy_conn_ent::proxy_id, PROXY_INVALID_ID, pthread_mutex_lock, pthread_mutex_unlock, shm_proxy_p, and t_proxy_conn_ent::status.
Referenced by proxy_listener_thr_f().
int broker_set_proxy_fds | ( | fd_set * | fds | ) |
Definition at line 69 of file broker_proxy_conn.c.
References t_proxy_conn_ent::fd, INVALID_SOCKET, t_proxy_conn_ent::next, PROXY_CONN_CONNECTED, t_proxy_conn::proxy_conn_ent, proxy_conn_mutex, pthread_mutex_lock, pthread_mutex_unlock, and t_proxy_conn_ent::status.
Referenced by proxy_listener_thr_f().
T_PROXY_CONN broker_Proxy_conn |
Definition at line 40 of file broker_proxy_conn.c.
pthread_mutex_t proxy_conn_mutex |
Definition at line 46 of file broker_proxy_conn.c.
Referenced by broker_add_proxy_conn(), broker_delete_proxy_conn_by_fd(), broker_delete_proxy_conn_by_proxy_id(), broker_destroy_proxy_conn(), broker_find_available_proxy(), broker_get_proxy_conn_maxfd(), broker_get_readable_proxy_conn(), broker_init_proxy_conn(), broker_register_proxy_conn(), and broker_set_proxy_fds().