mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 08:04:14 +02:00
parent
e6c6a7dc52
commit
1119c2f17b
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "livestatus/listener.h"
|
#include "livestatus/listener.h"
|
||||||
#include "config/configcompilercontext.h"
|
#include "config/configcompilercontext.h"
|
||||||
|
#include "base/utility.h"
|
||||||
#include "base/objectlock.h"
|
#include "base/objectlock.h"
|
||||||
#include "base/dynamictype.h"
|
#include "base/dynamictype.h"
|
||||||
#include "base/logger_fwd.h"
|
#include "base/logger_fwd.h"
|
||||||
@ -103,12 +104,11 @@ void LivestatusListener::ServerThreadProc(const Socket::Ptr& server)
|
|||||||
|
|
||||||
Log(LogInformation, "livestatus", "Client connected");
|
Log(LogInformation, "livestatus", "Client connected");
|
||||||
|
|
||||||
boost::thread thread(boost::bind(&LivestatusListener::ClientThreadProc, this, client));
|
Utility::QueueAsyncCallback(boost::bind(&LivestatusListener::ClientHandler, this, client));
|
||||||
thread.detach();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LivestatusListener::ClientThreadProc(const Socket::Ptr& client)
|
void LivestatusListener::ClientHandler(const Socket::Ptr& client)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(l_ComponentMutex);
|
boost::mutex::scoped_lock lock(l_ComponentMutex);
|
||||||
@ -131,17 +131,9 @@ void LivestatusListener::ClientThreadProc(const Socket::Ptr& client)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
Query::Ptr query = make_shared<Query>(lines, GetCompatLogPath());
|
||||||
Query::Ptr query = make_shared<Query>(lines, GetCompatLogPath());
|
if (!query->Execute(stream))
|
||||||
if (!query->Execute(stream))
|
break;
|
||||||
break;
|
|
||||||
} catch (const std::exception& ex) {
|
|
||||||
std::ostringstream info;
|
|
||||||
info << "Exception thrown while running livestatus query: " << std::endl
|
|
||||||
<< DiagnosticInformation(ex);
|
|
||||||
Log(LogCritical, "livestatus", info.str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void ServerThreadProc(const Socket::Ptr& server);
|
void ServerThreadProc(const Socket::Ptr& server);
|
||||||
void ClientThreadProc(const Socket::Ptr& client);
|
void ClientHandler(const Socket::Ptr& client);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user