summaryrefslogtreecommitdiff
path: root/src/socketengines/socketengine_epoll.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-30 18:31:05 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-30 18:31:05 +0000
commit7aa5e059a8f66d91bd8b69c58c657ceb70b4baff (patch)
tree3c846a54d4391ff662d0339fd7854a1c215ba7e5 /src/socketengines/socketengine_epoll.cpp
parent4a64082e31c3c3dfa97a1edfb8a3c97fe8d32ea7 (diff)
Remove include/inspircd_se_config.h and socketengine-specific headers
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11784 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengines/socketengine_epoll.cpp')
-rw-r--r--src/socketengines/socketengine_epoll.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp
index 059798d25..c1b22ffba 100644
--- a/src/socketengines/socketengine_epoll.cpp
+++ b/src/socketengines/socketengine_epoll.cpp
@@ -11,10 +11,38 @@
* ---------------------------------------------------
*/
+#include <vector>
+#include <string>
+#include <map>
#include "inspircd.h"
#include "exitcodes.h"
-#include "socketengines/socketengine_epoll.h"
+#include "socketengine.h"
+#include <sys/epoll.h>
#include <ulimit.h>
+#define EP_DELAY 5
+
+/** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll().
+ */
+class EPollEngine : public SocketEngine
+{
+private:
+ /** These are used by epoll() to hold socket events
+ */
+ struct epoll_event* events;
+ int EngineHandle;
+public:
+ /** Create a new EPollEngine
+ */
+ EPollEngine();
+ /** Delete an EPollEngine
+ */
+ virtual ~EPollEngine();
+ virtual bool AddFd(EventHandler* eh, int event_mask);
+ virtual void OnSetEvent(EventHandler* eh, int old_mask, int new_mask);
+ virtual bool DelFd(EventHandler* eh, bool force = false);
+ virtual int DispatchEvents();
+ virtual std::string GetName();
+};
EPollEngine::EPollEngine()
{
@@ -216,3 +244,7 @@ std::string EPollEngine::GetName()
return "epoll";
}
+SocketEngine* CreateSocketEngine()
+{
+ return new EPollEngine;
+}