From 819d346b31e8a924be10d62750f7c2c7b812fef6 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Sun, 10 Sep 2017 18:30:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9maat=5Fjson=E7=AC=94=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Dredis=20busy=E6=97=B6reply=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E9=87=8A=E6=94=BE=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entry/Maat_command.cpp | 2 ++ src/entry/json2iris.cpp | 4 +++- test/maat_json.json | 26 +++++++++++++------------- test/maat_test.cpp | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/entry/Maat_command.cpp b/src/entry/Maat_command.cpp index dfe2b5f..5afd085 100644 --- a/src/entry/Maat_command.cpp +++ b/src/entry/Maat_command.cpp @@ -368,6 +368,8 @@ int get_rm_key_list(unsigned int version,redisContext *c,struct serial_rule_t** if(reply->type==REDIS_REPLY_NIL||reply->type==REDIS_REPLY_ERROR) { MESA_handle_runtime_log(logger, RLOG_LV_FATAL, maat_redis_monitor,"GET MAAT_VERSION failed, maybe Redis is busy."); + freeReplyObject(reply); + reply=NULL; return -1; } } diff --git a/src/entry/json2iris.cpp b/src/entry/json2iris.cpp index ffc16aa..1e042a2 100644 --- a/src/entry/json2iris.cpp +++ b/src/entry/json2iris.cpp @@ -676,8 +676,10 @@ int write_compile_rule(cJSON *compile,struct iris_description_t *p_iris,void * l compile_cmd[cmd_cnt].json_type=cJSON_Number; cmd_cnt++; - compile_cmd[cmd_cnt].json_string="effective_rage"; + compile_cmd[cmd_cnt].json_string="effective_range"; compile_cmd[cmd_cnt].json_type=cJSON_Number; + compile_cmd[cmd_cnt].empty_allowed=1; + compile_cmd[cmd_cnt].default_int=0; cmd_cnt++; compile_cmd[cmd_cnt].json_string="user_region"; diff --git a/test/maat_json.json b/test/maat_json.json index 2363f48..410b51f 100644 --- a/test/maat_json.json +++ b/test/maat_json.json @@ -8,7 +8,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "anything", "is_valid": "yes", "groups": [ @@ -74,7 +74,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "anything", "is_valid": "yes", "groups": [ @@ -102,7 +102,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "anything", "is_valid": "yes", "groups": [ @@ -128,7 +128,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "anything", "is_valid": "yes", "groups": [ @@ -168,7 +168,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "anything", "is_valid": "yes", "groups": [ @@ -194,7 +194,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "anything", "is_valid": "yes", "groups": [ @@ -222,7 +222,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "utf8_中文", "is_valid": "yes", "groups": [ @@ -249,7 +249,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "utf8_维语", "is_valid": "yes", "groups": [ @@ -276,7 +276,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "utf8_维语2", "is_valid": "yes", "groups": [ @@ -303,7 +303,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "string\\bunescape", "is_valid": "yes", "groups": [ @@ -330,7 +330,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "table_conjunction_test_part1", "is_valid": "yes", "groups": [ @@ -357,7 +357,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "table_conjunction_test_part2", "is_valid": "yes", "groups": [ @@ -384,7 +384,7 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "effective_rage": 0, + "effective_range": 0, "user_region": "anything", "is_valid": "yes", "groups": [ diff --git a/test/maat_test.cpp b/test/maat_test.cpp index 1b3f9d4..51dbec9 100644 --- a/test/maat_test.cpp +++ b/test/maat_test.cpp @@ -499,7 +499,7 @@ void test_set_cmd_line(Maat_feather_t feather) char table_line[TEST_CMD_LINE_NUM][128]; int ret=0,i=0; memset(&line_rule,0,sizeof(line_rule)); - for(i=0;i<4;i++) + for(i=0;i