Fix problems related to save settings

This commit is contained in:
lazio579 2019-03-25 10:24:16 +08:00
parent 644ce3e252
commit 76c3d08617
3 changed files with 7 additions and 6 deletions

View File

@ -68,6 +68,7 @@ typedef struct chassis chassis;
#define MAX_DIST_TRAN_PREFIX 64 #define MAX_DIST_TRAN_PREFIX 64
#define DEFAULT_LIVE_TIME 7200 #define DEFAULT_LIVE_TIME 7200
#define DEFAULT_POOL_SIZE 10
#define MAX_ALLOWED_PACKET_CEIL (1 * GB) #define MAX_ALLOWED_PACKET_CEIL (1 * GB)
#define MAX_ALLOWED_PACKET_DEFAULT (32 * MB) #define MAX_ALLOWED_PACKET_DEFAULT (32 * MB)
#define MAX_ALLOWED_PACKET_FLOOR (1 * KB) #define MAX_ALLOWED_PACKET_FLOOR (1 * KB)

View File

@ -454,7 +454,7 @@ show_default_pool_size(gpointer param) {
return g_strdup_printf("%d", srv->mid_idle_connections); return g_strdup_printf("%d", srv->mid_idle_connections);
} }
if (CAN_SAVE_OPTS_PROPERTY(opt_type)) { if (CAN_SAVE_OPTS_PROPERTY(opt_type)) {
if (srv->mid_idle_connections == 100) { if (srv->mid_idle_connections == DEFAULT_POOL_SIZE) {
return NULL; return NULL;
} }
return g_strdup_printf("%d", srv->mid_idle_connections); return g_strdup_printf("%d", srv->mid_idle_connections);
@ -473,8 +473,8 @@ assign_default_pool_size(const gchar *newval, gpointer param) {
gint value = 0; gint value = 0;
if (try_get_int_value(newval, &value)) { if (try_get_int_value(newval, &value)) {
if (value >= 0) { if (value >= 0) {
if (value < 10) { if (value < DEFAULT_POOL_SIZE) {
value = 10; value = DEFAULT_POOL_SIZE;
} }
srv->mid_idle_connections = value; srv->mid_idle_connections = value;

View File

@ -190,7 +190,7 @@ chassis_frontend_new(void)
frontend->is_client_compress_support = 0; frontend->is_client_compress_support = 0;
frontend->xa_log_detailed = 0; frontend->xa_log_detailed = 0;
frontend->default_pool_size = 10; frontend->default_pool_size = DEFAULT_POOL_SIZE;
frontend->worker_processes = 1; frontend->worker_processes = 1;
frontend->max_resp_len = 10 * 1024 * 1024; /* 10M */ frontend->max_resp_len = 10 * 1024 * 1024; /* 10M */
frontend->max_alive_time = DEFAULT_LIVE_TIME; frontend->max_alive_time = DEFAULT_LIVE_TIME;
@ -701,8 +701,8 @@ init_parameters(struct chassis_frontend_t *frontend, chassis *srv)
g_message("set worker processes:%d", srv->worker_processes); g_message("set worker processes:%d", srv->worker_processes);
if (frontend->default_pool_size < 10) { if (frontend->default_pool_size < DEFAULT_POOL_SIZE) {
frontend->default_pool_size = 10; frontend->default_pool_size = DEFAULT_POOL_SIZE;
} }
srv->mid_idle_connections = frontend->default_pool_size; srv->mid_idle_connections = frontend->default_pool_size;