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 <hiredis/hiredis.h>
|
||||||
#include <base/logger.hpp>
|
#include <base/logger.hpp>
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
|
#include "redis/rediswriter.hpp"
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
/*
|
/*
|
||||||
|
@ -80,9 +81,14 @@ void RedisConnection::Connect() {
|
||||||
//TODO: Authentication, DB selection, error handling
|
//TODO: Authentication, DB selection, error handling
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RedisConnection::Disconnect()
|
||||||
|
{
|
||||||
|
redisAsyncDisconnect(m_Context);
|
||||||
|
}
|
||||||
|
|
||||||
void RedisConnection::DisconnectCallback(const redisAsyncContext *c, int status) {
|
void RedisConnection::DisconnectCallback(const redisAsyncContext *c, int status) {
|
||||||
if (status == REDIS_OK)
|
if (status == REDIS_OK)
|
||||||
Log(LogCritical, "RedisWriter") << "Redis disconnected by user";
|
Log(LogInformation, "RedisWriter") << "Redis disconnected by us";
|
||||||
else
|
else
|
||||||
Log(LogCritical, "Rediswriter") << "Redis disconnected for reasons";
|
Log(LogCritical, "Rediswriter") << "Redis disconnected for reasons";
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,10 @@ public:
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
void Connect();
|
void Connect();
|
||||||
|
void Disconnect();
|
||||||
|
|
||||||
void ExecuteQuery(const std::vector<String>& query, 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 = nullptr, void *privdata = nullptr);
|
void ExecuteQueries(const std::vector<std::vector<String> >& queries, redisCallbackFn *fn = NULL, void *privdata = NULL);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue