Skip to content

Commit

Permalink
eve: check redis reply in non pipeline mode
Browse files Browse the repository at this point in the history
We may lose the reply if disconnection happens.
Reconnection is needed.
  • Loading branch information
fooinha authored and victorjulien committed Nov 1, 2016
1 parent d35613f commit 90276f0
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/util-logopenfile.c
Expand Up @@ -597,21 +597,26 @@ static int LogFileWriteRedis(LogFileCtx *file_ctx, const char *string, size_t s
file_ctx->redis_setup.key,
string);

switch (reply->type) {
case REDIS_REPLY_ERROR:
SCLogWarning(SC_ERR_SOCKET, "Redis error: %s", reply->str);
SCConfLogReopenRedis(file_ctx);
break;
case REDIS_REPLY_INTEGER:
SCLogDebug("Redis integer %lld", reply->integer);
break;
default:
SCLogError(SC_ERR_INVALID_VALUE,
"Redis default triggered with %d", reply->type);
SCConfLogReopenRedis(file_ctx);
break;
/* We may lose the reply if disconnection happens! */
if (reply) {
switch (reply->type) {
case REDIS_REPLY_ERROR:
SCLogWarning(SC_ERR_SOCKET, "Redis error: %s", reply->str);
SCConfLogReopenRedis(file_ctx);
break;
case REDIS_REPLY_INTEGER:
SCLogDebug("Redis integer %lld", reply->integer);
break;
default:
SCLogError(SC_ERR_INVALID_VALUE,
"Redis default triggered with %d", reply->type);
SCConfLogReopenRedis(file_ctx);
break;
}
freeReplyObject(reply);
} else {
SCConfLogReopenRedis(file_ctx);
}
freeReplyObject(reply);
}
return 0;
}
Expand Down

0 comments on commit 90276f0

Please sign in to comment.