mirror of https://github.com/Icinga/icinga2.git
Initialize Socket Event Engine on application startup
Previously this happened inside the TlsStream constructor during the first connection attempt.
This commit is contained in:
parent
eee4426dcb
commit
c8dcd1297f
|
@ -35,6 +35,8 @@ static SocketEventEngine *l_SocketIOEngine;
|
||||||
|
|
||||||
int SocketEvents::m_NextID = 0;
|
int SocketEvents::m_NextID = 0;
|
||||||
|
|
||||||
|
INITIALIZE_ONCE(&SocketEvents::InitializeEngine);
|
||||||
|
|
||||||
void SocketEventEngine::Start()
|
void SocketEventEngine::Start()
|
||||||
{
|
{
|
||||||
for (int tid = 0; tid < SOCKET_IOTHREADS; tid++) {
|
for (int tid = 0; tid < SOCKET_IOTHREADS; tid++) {
|
||||||
|
@ -114,8 +116,6 @@ void SocketEvents::InitializeEngine()
|
||||||
SocketEvents::SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject)
|
SocketEvents::SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject)
|
||||||
: m_ID(m_NextID++), m_FD(socket->GetFD()), m_EnginePrivate(nullptr)
|
: m_ID(m_NextID++), m_FD(socket->GetFD()), m_EnginePrivate(nullptr)
|
||||||
{
|
{
|
||||||
boost::call_once(l_SocketIOOnceFlag, &SocketEvents::InitializeEngine);
|
|
||||||
|
|
||||||
Register(lifesupportObject);
|
Register(lifesupportObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
void *GetEnginePrivate() const;
|
void *GetEnginePrivate() const;
|
||||||
void SetEnginePrivate(void *priv);
|
void SetEnginePrivate(void *priv);
|
||||||
|
|
||||||
|
static void InitializeEngine();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject);
|
SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject);
|
||||||
|
|
||||||
|
@ -64,8 +66,6 @@ private:
|
||||||
|
|
||||||
static int m_NextID;
|
static int m_NextID;
|
||||||
|
|
||||||
static void InitializeEngine();
|
|
||||||
|
|
||||||
void WakeUpThread(bool wait = false);
|
void WakeUpThread(bool wait = false);
|
||||||
|
|
||||||
void Register(Object *lifesupportObject);
|
void Register(Object *lifesupportObject);
|
||||||
|
|
Loading…
Reference in New Issue