Return on redis connection error. (#1030)
This commit is contained in:
parent
56cb305ae3
commit
c9f98e1bf3
|
@ -38,11 +38,20 @@ void RedisConnection::startConnectionInLoop()
|
|||
if (redisContext_->err)
|
||||
{
|
||||
LOG_ERROR << "Error: " << redisContext_->errstr;
|
||||
|
||||
if (disconnectCallback_)
|
||||
{
|
||||
disconnectCallback_(shared_from_this());
|
||||
}
|
||||
|
||||
// Strange things have happend. In some kinds of connection errors, such
|
||||
// as setsockopt errors, hiredis already set redisContext_->c.fd to -1,
|
||||
// but the tcp connection stays in ESTABLISHED status. And there is no
|
||||
// way for us to obtain the fd of that socket nor close it. This
|
||||
// probably is a bug of hiredis.
|
||||
return;
|
||||
}
|
||||
|
||||
redisContext_->ev.addWrite = addWrite;
|
||||
redisContext_->ev.delWrite = delWrite;
|
||||
redisContext_->ev.addRead = addRead;
|
||||
|
|
Loading…
Reference in New Issue