mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-02 20:08:21 +08:00
fixed bug in redis_command::run where existing a invlid conn's refering
This commit is contained in:
parent
70387f948e
commit
33125fe158
@ -1,8 +1,12 @@
|
||||
修改历史列表:
|
||||
|
||||
------------------------------------------------------------------------
|
||||
328) 2015.7.19
|
||||
328.1) bugfix: redis_command.cpp 中的 run(redis_client_cluster*, size_t) 函数
|
||||
中可能存在当 conn 对象被释放后再次非法引用的情形,现在将该对象的释放放在引用的代码之后
|
||||
|
||||
327) 2015.7.16
|
||||
327.1) bugfix: redis_comman.cpp 中的 run(redis_client_cluster*, size_t) 函数
|
||||
327.1) bugfix: redis_command.cpp 中的 run(redis_client_cluster*, size_t) 函数
|
||||
中,当 conf->eof() 时,若 conn = peek_conn(xxx) 返回 NULL,则应直接返回 NULL,否则
|
||||
会引起下面的空指针引用异常
|
||||
|
||||
|
@ -174,7 +174,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\include;..\lib_acl\include;..\lib_protocol\include;..\include\sqlite;..\include\zlib;..\include\mysql;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;USE_WIN_ICONV;HAS_POLARSSL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;_MT;USE_WIN_ICONV;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -423,13 +423,12 @@ const redis_result* redis_command::run(redis_client_cluster* cluster,
|
||||
continue;
|
||||
}
|
||||
|
||||
// 将连接对象归还给连接池对象
|
||||
else
|
||||
conn->get_pool()->put(conn, true);
|
||||
|
||||
if (result_ == NULL)
|
||||
{
|
||||
// 将连接对象归还给连接池对象
|
||||
conn->get_pool()->put(conn, true);
|
||||
logger_error("result NULL");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -438,7 +437,10 @@ const redis_result* redis_command::run(redis_client_cluster* cluster,
|
||||
|
||||
if (type == REDIS_RESULT_UNKOWN)
|
||||
{
|
||||
// 将连接对象归还给连接池对象
|
||||
conn->get_pool()->put(conn, true);
|
||||
logger_error("unknown result type: %d", type);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -446,14 +448,26 @@ const redis_result* redis_command::run(redis_client_cluster* cluster,
|
||||
{
|
||||
// 如果发生重定向过程,则设置哈希槽对应 redis 服务地址
|
||||
if (slot_ < 0 || !last_moved)
|
||||
{
|
||||
// 将连接对象归还给连接池对象
|
||||
conn->get_pool()->put(conn, true);
|
||||
return result_;
|
||||
}
|
||||
|
||||
// XXX: 因为此处还要引用一次 conn 对象,所以将 conn
|
||||
// 归还给连接池的过程须放在此段代码之后
|
||||
const char* addr = conn->get_pool()->get_addr();
|
||||
cluster->set_slot(slot_, addr);
|
||||
|
||||
// 将连接对象归还给连接池对象
|
||||
conn->get_pool()->put(conn, true);
|
||||
|
||||
return result_;
|
||||
}
|
||||
|
||||
// 以下过程不再引用该次的 conn 对象,此处将连接对象归还给连接池对象
|
||||
conn->get_pool()->put(conn, true);
|
||||
|
||||
#define EQ(x, y) !strncasecmp((x), (y), sizeof(y) -1)
|
||||
|
||||
// 对于结果类型为错误类型,则需要进一步判断是否是重定向指令
|
||||
|
Loading…
Reference in New Issue
Block a user