diff --git a/lib/redis/redisconnection.cpp b/lib/redis/redisconnection.cpp index f4a0ee93d..721433339 100644 --- a/lib/redis/redisconnection.cpp +++ b/lib/redis/redisconnection.cpp @@ -23,6 +23,7 @@ #include #include #include "base/utility.hpp" +#include "redis/rediswriter.hpp" using namespace icinga; /* @@ -80,9 +81,14 @@ void RedisConnection::Connect() { //TODO: Authentication, DB selection, error handling } +void RedisConnection::Disconnect() +{ + redisAsyncDisconnect(m_Context); +} + void RedisConnection::DisconnectCallback(const redisAsyncContext *c, int status) { if (status == REDIS_OK) - Log(LogCritical, "RedisWriter") << "Redis disconnected by user"; + Log(LogInformation, "RedisWriter") << "Redis disconnected by us"; else Log(LogCritical, "Rediswriter") << "Redis disconnected for reasons"; diff --git a/lib/redis/redisconnection.hpp b/lib/redis/redisconnection.hpp index bcab12f5d..f23753235 100644 --- a/lib/redis/redisconnection.hpp +++ b/lib/redis/redisconnection.hpp @@ -40,9 +40,10 @@ public: void Start(); void Connect(); + void Disconnect(); - void ExecuteQuery(const std::vector& query, redisCallbackFn *fn = nullptr, void *privdata = nullptr); - void ExecuteQueries(const std::vector >& queries, redisCallbackFn *fn = nullptr, void *privdata = nullptr); + void ExecuteQuery(const std::vector& query, redisCallbackFn *fn = NULL, void *privdata = NULL); + void ExecuteQueries(const std::vector >& queries, redisCallbackFn *fn = NULL, void *privdata = NULL); private: