mirror of
https://github.com/openappsec/openappsec.git
synced 2025-06-28 16:41:02 +03:00
Add BC support for hiredis
This commit is contained in:
parent
cec0276df1
commit
bc3359a1c1
@ -398,21 +398,14 @@ public:
|
|||||||
{
|
{
|
||||||
disconnectRedis();
|
disconnectRedis();
|
||||||
|
|
||||||
redisOptions options;
|
const string &redis_ip = getConfigurationWithDefault<string>("127.0.0.1", "connection", "Redis IP");
|
||||||
memset(&options, 0, sizeof(redisOptions));
|
int redis_port = getConfigurationWithDefault<int>(6379, "connection", "Redis Port");
|
||||||
REDIS_OPTIONS_SET_TCP(
|
|
||||||
&options,
|
|
||||||
"127.0.0.1",
|
|
||||||
getConfigurationWithDefault<int>(6379, "connection", "Redis Port")
|
|
||||||
);
|
|
||||||
|
|
||||||
timeval timeout;
|
timeval timeout;
|
||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
timeout.tv_usec = getConfigurationWithDefault<int>(30000, "connection", "Redis Timeout");
|
timeout.tv_usec = getConfigurationWithDefault<int>(30000, "connection", "Redis Timeout");
|
||||||
options.connect_timeout = &timeout;
|
|
||||||
options.command_timeout = &timeout;
|
|
||||||
|
|
||||||
redisContext* context = redisConnectWithOptions(&options);
|
redisContext* context = redisConnectWithTimeout(redis_ip.c_str(), redis_port, timeout);
|
||||||
if (context != nullptr && context->err) {
|
if (context != nullptr && context->err) {
|
||||||
dbgDebug(D_RATE_LIMIT)
|
dbgDebug(D_RATE_LIMIT)
|
||||||
<< "Error connecting to Redis: "
|
<< "Error connecting to Redis: "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user