diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-21 13:26:31 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-21 13:26:31 +0000 |
commit | e2af2347fc035d702e45f12e772223a8d578410d (patch) | |
tree | bfd80aac2858a9f4faedc316794fc1051dbaa72c /include/socketengines | |
parent | 16fc672b685752007e47aed0fb97bc1ee7443c76 (diff) |
Create StreamSocket for IO hooking implementation
Fixes the SSL SendQ bug
Removes duplicate code between User and BufferedSocket
Simplify SSL module API
Simplify EventHandler API (Readable/Writeable moved to SE)
Add hook for culled objects to invoke callbacks prior to destructor
Replace SocketCull with GlobalCull now that sockets can close themselves
Shorten common case of user read/parse/write path:
User::Write is now zero-copy up to syscall/SSL invocation
User::Read has only two copy/scan passes from read() to ProcessCommand
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11752 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/socketengines')
-rw-r--r-- | include/socketengines/socketengine_epoll.h | 9 | ||||
-rw-r--r-- | include/socketengines/socketengine_iocp.h | 6 | ||||
-rw-r--r-- | include/socketengines/socketengine_kqueue.h | 9 | ||||
-rw-r--r-- | include/socketengines/socketengine_poll.h | 7 | ||||
-rw-r--r-- | include/socketengines/socketengine_ports.h | 8 | ||||
-rw-r--r-- | include/socketengines/socketengine_select.h | 8 |
6 files changed, 18 insertions, 29 deletions
diff --git a/include/socketengines/socketengine_epoll.h b/include/socketengines/socketengine_epoll.h index 6e6818212..3e08179ae 100644 --- a/include/socketengines/socketengine_epoll.h +++ b/include/socketengines/socketengine_epoll.h @@ -23,8 +23,6 @@ #include <sys/epoll.h> #define EP_DELAY 5 -class InspIRCd; - /** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll(). */ class EPollEngine : public SocketEngine @@ -35,13 +33,12 @@ private: struct epoll_event* events; public: /** Create a new EPollEngine - * @param Instance The creator of this object */ - EPollEngine(InspIRCd* Instance); + EPollEngine(); /** Delete an EPollEngine */ virtual ~EPollEngine(); - virtual bool AddFd(EventHandler* eh); + virtual bool AddFd(EventHandler* eh, bool writeFirst = false); virtual int GetMaxFds(); virtual int GetRemainingFds(); virtual bool DelFd(EventHandler* eh, bool force = false); @@ -57,7 +54,7 @@ class SocketEngineFactory public: /** Create a new instance of SocketEngine based on EpollEngine */ - SocketEngine* Create(InspIRCd* Instance) { return new EPollEngine(Instance); } + SocketEngine* Create() { return new EPollEngine; } }; #endif diff --git a/include/socketengines/socketengine_iocp.h b/include/socketengines/socketengine_iocp.h index 302fdbd2c..dd34227d3 100644 --- a/include/socketengines/socketengine_iocp.h +++ b/include/socketengines/socketengine_iocp.h @@ -121,7 +121,7 @@ public: /** Creates an IOCP Socket Engine * @param Instance The creator of this object */ - IOCPEngine(InspIRCd* Instance); + IOCPEngine(); /** Deletes an IOCP socket engine and all the attached sockets */ @@ -131,7 +131,7 @@ public: * @param eh EventHandler to add * @return True if success, false if no room */ - bool AddFd(EventHandler* eh); + bool AddFd(EventHandler* eh, bool writeFirst = false); /** Gets the maximum number of file descriptors that this engine can handle. * @return The number of file descriptors @@ -234,7 +234,7 @@ class SocketEngineFactory public: /** Create a new instance of SocketEngine based on IOCPEngine */ - SocketEngine* Create(InspIRCd* Instance) { return new IOCPEngine(Instance); } + SocketEngine* Create() { return new IOCPEngine; } }; #endif diff --git a/include/socketengines/socketengine_kqueue.h b/include/socketengines/socketengine_kqueue.h index 41459f561..a09e93553 100644 --- a/include/socketengines/socketengine_kqueue.h +++ b/include/socketengines/socketengine_kqueue.h @@ -24,8 +24,6 @@ #include <sys/time.h> #include "socketengine.h" -class InspIRCd; - /** A specialisation of the SocketEngine class, designed to use FreeBSD kqueue(). */ class KQueueEngine : public SocketEngine @@ -39,13 +37,12 @@ private: struct timespec ts; public: /** Create a new KQueueEngine - * @param Instance The creator of this object */ - KQueueEngine(InspIRCd* Instance); + KQueueEngine(); /** Delete a KQueueEngine */ virtual ~KQueueEngine(); - virtual bool AddFd(EventHandler* eh); + virtual bool AddFd(EventHandler* eh, bool writeFirst = false); virtual int GetMaxFds(); virtual int GetRemainingFds(); virtual bool DelFd(EventHandler* eh, bool force = false); @@ -62,7 +59,7 @@ class SocketEngineFactory public: /** Create a new instance of SocketEngine based on KQueueEngine */ - SocketEngine* Create(InspIRCd* Instance) { return new KQueueEngine(Instance); } + SocketEngine* Create() { return new KQueueEngine; } }; #endif diff --git a/include/socketengines/socketengine_poll.h b/include/socketengines/socketengine_poll.h index df1100d09..725ad225c 100644 --- a/include/socketengines/socketengine_poll.h +++ b/include/socketengines/socketengine_poll.h @@ -48,13 +48,12 @@ private: std::map<int, unsigned int> fd_mappings; public: /** Create a new PollEngine - * @param Instance The creator of this object */ - PollEngine(InspIRCd* Instance); + PollEngine(); /** Delete a PollEngine */ virtual ~PollEngine(); - virtual bool AddFd(EventHandler* eh); + virtual bool AddFd(EventHandler* eh, bool writeFirst = false); virtual EventHandler* GetRef(int fd); virtual int GetMaxFds(); virtual int GetRemainingFds(); @@ -71,7 +70,7 @@ class SocketEngineFactory public: /** Create a new instance of SocketEngine based on PollEngine */ - SocketEngine* Create(InspIRCd* Instance) { return new PollEngine(Instance); } + SocketEngine* Create() { return new PollEngine; } }; #endif diff --git a/include/socketengines/socketengine_ports.h b/include/socketengines/socketengine_ports.h index 40d5da51a..03df456f2 100644 --- a/include/socketengines/socketengine_ports.h +++ b/include/socketengines/socketengine_ports.h @@ -26,8 +26,6 @@ #include "socketengine.h" #include <port.h> -class InspIRCd; - /** A specialisation of the SocketEngine class, designed to use solaris 10 I/O completion ports */ class PortsEngine : public SocketEngine @@ -40,11 +38,11 @@ public: /** Create a new PortsEngine * @param Instance The creator of this object */ - PortsEngine(InspIRCd* Instance); + PortsEngine(); /** Delete a PortsEngine */ virtual ~PortsEngine(); - virtual bool AddFd(EventHandler* eh); + virtual bool AddFd(EventHandler* eh, bool writeFirst = false); virtual int GetMaxFds(); virtual int GetRemainingFds(); virtual bool DelFd(EventHandler* eh, bool force = false); @@ -60,7 +58,7 @@ class SocketEngineFactory public: /** Create a new instance of SocketEngine based on PortsEngine */ - SocketEngine* Create(InspIRCd* Instance) { return new PortsEngine(Instance); } + SocketEngine* Create() { return new PortsEngine; } }; #endif diff --git a/include/socketengines/socketengine_select.h b/include/socketengines/socketengine_select.h index a248e8a8e..a1993f19f 100644 --- a/include/socketengines/socketengine_select.h +++ b/include/socketengines/socketengine_select.h @@ -24,8 +24,6 @@ #include "inspircd.h" #include "socketengine.h" -class InspIRCd; - /** A specialisation of the SocketEngine class, designed to use traditional select(). */ class SelectEngine : public SocketEngine @@ -45,11 +43,11 @@ public: /** Create a new SelectEngine * @param Instance The creator of this object */ - SelectEngine(InspIRCd* Instance); + SelectEngine(); /** Delete a SelectEngine */ virtual ~SelectEngine(); - virtual bool AddFd(EventHandler* eh); + virtual bool AddFd(EventHandler* eh, bool writeFirst = false); virtual int GetMaxFds(); virtual int GetRemainingFds(); virtual bool DelFd(EventHandler* eh, bool force = false); @@ -65,7 +63,7 @@ class SocketEngineFactory public: /** Create a new instance of SocketEngine based on SelectEngine */ - SocketEngine* Create(InspIRCd* Instance) { return new SelectEngine(Instance); } + SocketEngine* Create() { return new SelectEngine; } }; #endif |