mirror of https://github.com/Icinga/icinga2.git
Add disconnect
This commit is contained in:
parent
d96dcf869e
commit
64515b81e3
|
@ -23,6 +23,7 @@
|
|||
#include <hiredis/hiredis.h>
|
||||
#include <base/logger.hpp>
|
||||
#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";
|
||||
|
||||
|
|
|
@ -40,9 +40,10 @@ public:
|
|||
void Start();
|
||||
|
||||
void Connect();
|
||||
void Disconnect();
|
||||
|
||||
void ExecuteQuery(const std::vector<String>& query, redisCallbackFn *fn = nullptr, void *privdata = nullptr);
|
||||
void ExecuteQueries(const std::vector<std::vector<String> >& queries, redisCallbackFn *fn = nullptr, void *privdata = nullptr);
|
||||
void ExecuteQuery(const std::vector<String>& query, redisCallbackFn *fn = NULL, void *privdata = NULL);
|
||||
void ExecuteQueries(const std::vector<std::vector<String> >& queries, redisCallbackFn *fn = NULL, void *privdata = NULL);
|
||||
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue