mirror of https://github.com/Icinga/icinga2.git
parent
5134ccaf56
commit
a2ae01e64b
|
@ -113,8 +113,6 @@ void SocketEventEngineEpoll::ThreadProc(int tid)
|
|||
EventDescription event;
|
||||
event.REvents = SocketEventEngineEpoll::EpollToPoll(pevents[i].events);
|
||||
event.Descriptor = m_Sockets[tid][pevents[i].data.fd];
|
||||
event.LifesupportReference = event.Descriptor.LifesupportObject;
|
||||
VERIFY(event.LifesupportReference);
|
||||
|
||||
events.emplace_back(std::move(event));
|
||||
}
|
||||
|
@ -134,7 +132,7 @@ void SocketEventEngineEpoll::ThreadProc(int tid)
|
|||
}
|
||||
}
|
||||
|
||||
void SocketEventEngineEpoll::Register(SocketEvents *se, Object *lifesupportObject)
|
||||
void SocketEventEngineEpoll::Register(SocketEvents *se)
|
||||
{
|
||||
int tid = se->m_ID % SOCKET_IOTHREADS;
|
||||
|
||||
|
@ -145,7 +143,6 @@ void SocketEventEngineEpoll::Register(SocketEvents *se, Object *lifesupportObjec
|
|||
|
||||
SocketEventDescriptor desc;
|
||||
desc.EventInterface = se;
|
||||
desc.LifesupportObject = lifesupportObject;
|
||||
|
||||
VERIFY(m_Sockets[tid].find(se->m_FD) == m_Sockets[tid].end());
|
||||
|
||||
|
|
|
@ -111,8 +111,6 @@ void SocketEventEnginePoll::ThreadProc(int tid)
|
|||
EventDescription event;
|
||||
event.REvents = pfds[i].revents;
|
||||
event.Descriptor = descriptors[i];
|
||||
event.LifesupportReference = event.Descriptor.LifesupportObject;
|
||||
VERIFY(event.LifesupportReference);
|
||||
|
||||
events.emplace_back(std::move(event));
|
||||
}
|
||||
|
@ -132,7 +130,7 @@ void SocketEventEnginePoll::ThreadProc(int tid)
|
|||
}
|
||||
}
|
||||
|
||||
void SocketEventEnginePoll::Register(SocketEvents *se, Object *lifesupportObject)
|
||||
void SocketEventEnginePoll::Register(SocketEvents *se)
|
||||
{
|
||||
int tid = se->m_ID % SOCKET_IOTHREADS;
|
||||
|
||||
|
@ -144,7 +142,6 @@ void SocketEventEnginePoll::Register(SocketEvents *se, Object *lifesupportObject
|
|||
SocketEventDescriptor desc;
|
||||
desc.Events = 0;
|
||||
desc.EventInterface = se;
|
||||
desc.LifesupportObject = lifesupportObject;
|
||||
|
||||
VERIFY(m_Sockets[tid].find(se->m_FD) == m_Sockets[tid].end());
|
||||
|
||||
|
|
|
@ -111,12 +111,12 @@ void SocketEvents::InitializeEngine()
|
|||
/**
|
||||
* Constructor for the SocketEvents class.
|
||||
*/
|
||||
SocketEvents::SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject)
|
||||
SocketEvents::SocketEvents(const Socket::Ptr& socket)
|
||||
: m_ID(m_NextID++), m_FD(socket->GetFD()), m_EnginePrivate(nullptr)
|
||||
{
|
||||
boost::call_once(l_SocketIOOnceFlag, &SocketEvents::InitializeEngine);
|
||||
|
||||
Register(lifesupportObject);
|
||||
Register();
|
||||
}
|
||||
|
||||
SocketEvents::~SocketEvents()
|
||||
|
@ -124,9 +124,9 @@ SocketEvents::~SocketEvents()
|
|||
VERIFY(m_FD == INVALID_SOCKET);
|
||||
}
|
||||
|
||||
void SocketEvents::Register(Object *lifesupportObject)
|
||||
void SocketEvents::Register()
|
||||
{
|
||||
l_SocketIOEngine->Register(this, lifesupportObject);
|
||||
l_SocketIOEngine->Register(this);
|
||||
}
|
||||
|
||||
void SocketEvents::Unregister()
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
void SetEnginePrivate(void *priv);
|
||||
|
||||
protected:
|
||||
SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject);
|
||||
SocketEvents(const Socket::Ptr& socket);
|
||||
|
||||
private:
|
||||
int m_ID;
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
|
||||
void WakeUpThread(bool wait = false);
|
||||
|
||||
void Register(Object *lifesupportObject);
|
||||
void Register();
|
||||
|
||||
friend class SocketEventEnginePoll;
|
||||
friend class SocketEventEngineEpoll;
|
||||
|
@ -83,14 +83,12 @@ struct SocketEventDescriptor
|
|||
{
|
||||
int Events{POLLIN};
|
||||
SocketEvents::Ptr EventInterface;
|
||||
Object *LifesupportObject{nullptr};
|
||||
};
|
||||
|
||||
struct EventDescription
|
||||
{
|
||||
int REvents;
|
||||
SocketEventDescriptor Descriptor;
|
||||
Object::Ptr LifesupportReference;
|
||||
};
|
||||
|
||||
class SocketEventEngine
|
||||
|
@ -105,7 +103,7 @@ public:
|
|||
protected:
|
||||
virtual void InitializeThread(int tid) = 0;
|
||||
virtual void ThreadProc(int tid) = 0;
|
||||
virtual void Register(SocketEvents *se, Object *lifesupportObject) = 0;
|
||||
virtual void Register(SocketEvents *se) = 0;
|
||||
virtual void Unregister(SocketEvents *se) = 0;
|
||||
virtual void ChangeEvents(SocketEvents *se, int events) = 0;
|
||||
|
||||
|
@ -122,7 +120,7 @@ protected:
|
|||
class SocketEventEnginePoll final : public SocketEventEngine
|
||||
{
|
||||
public:
|
||||
void Register(SocketEvents *se, Object *lifesupportObject) override;
|
||||
void Register(SocketEvents *se) override;
|
||||
void Unregister(SocketEvents *se) override;
|
||||
void ChangeEvents(SocketEvents *se, int events) override;
|
||||
|
||||
|
@ -135,7 +133,7 @@ protected:
|
|||
class SocketEventEngineEpoll : public SocketEventEngine
|
||||
{
|
||||
public:
|
||||
virtual void Register(SocketEvents *se, Object *lifesupportObject);
|
||||
virtual void Register(SocketEvents *se);
|
||||
virtual void Unregister(SocketEvents *se);
|
||||
virtual void ChangeEvents(SocketEvents *se, int events);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ bool TlsStream::m_SSLIndexInitialized = false;
|
|||
* @param sslContext The SSL context for the client.
|
||||
*/
|
||||
TlsStream::TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const std::shared_ptr<SSL_CTX>& sslContext)
|
||||
: SocketEvents(socket, this), m_Eof(false), m_HandshakeOK(false), m_VerifyOK(true), m_ErrorCode(0),
|
||||
: SocketEvents(socket), m_Eof(false), m_HandshakeOK(false), m_VerifyOK(true), m_ErrorCode(0),
|
||||
m_ErrorOccurred(false), m_Socket(socket), m_Role(role), m_SendQ(new FIFO()), m_RecvQ(new FIFO()),
|
||||
m_CurrentAction(TlsActionNone), m_Retry(false), m_Shutdown(false)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue