]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socketengine.cpp
Fix for crash found by potter if you set up two redirects in two channels to forward...
[user/henk/code/inspircd.git] / src / socketengine.cpp
index 4c164f31edeb05945cddc1a67a96b594a6b9d144..668335e6b17c0abcee8ed42a92415c7e23ab9efb 100644 (file)
@@ -2,56 +2,52 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *                <Craig@chatspike.net>
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
  *
- * Written by Craig Edwards, Craig McLure, and others.
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  *
  * ---------------------------------------------------
  */
 
-#include "inspircd_config.h"
-#include "globals.h"
 #include "inspircd.h"
-#ifdef USE_EPOLL
-#include <sys/epoll.h>
-#endif
-#ifdef USE_KQUEUE
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/time.h>
-#endif
-#include <vector>
-#include <string>
 #include "socketengine.h"
-#include "helperfuncs.h"
 
-SocketEngine::SocketEngine()
+int EventHandler::GetFd()
 {
-       printf("Something blew up in your face. class SocketEngine is an abstract class and configure must\n");
-       printf("select a socket engine to derive from it such as EPollEngine, KQueueEngine or SelectEngine.\n");
-       printf("Rerun configure, and try again.\n");
-       exit(0);
+       return this->fd;
 }
 
-SocketEngine::~SocketEngine()
+void EventHandler::SetFd(int FD)
 {
-       log(DEBUG,"SocketEngine::~SocketEngine()");
+       this->fd = FD;
 }
 
-char SocketEngine::GetType(int fd)
+bool EventHandler::Readable()
+{
+       return true;
+}
+
+bool EventHandler::Writeable()
+{
+       return false;
+}
+
+void SocketEngine::WantWrite(EventHandler* eh)
+{
+}
+
+SocketEngine::SocketEngine(InspIRCd* Instance) : ServerInstance(Instance)
+{
+       memset(ref, 0, sizeof(ref));
+}
+
+SocketEngine::~SocketEngine()
 {
-       if ((fd < 0) || (fd > MAX_DESCRIPTORS))
-               return X_EMPTY_SLOT;
-       /* Mask off the top bit used for 'read/write' state */
-       return (ref[fd] & ~0x80);
 }
 
-bool SocketEngine::AddFd(int fd, bool readable, char type)
+bool SocketEngine::AddFd(EventHandler* eh)
 {
        return true;
 }
@@ -60,10 +56,17 @@ bool SocketEngine::HasFd(int fd)
 {
        if ((fd < 0) || (fd > MAX_DESCRIPTORS))
                return false;
-       return (ref[fd] != 0);
+       return ref[fd];
 }
 
-bool SocketEngine::DelFd(int fd)
+EventHandler* SocketEngine::GetRef(int fd)
+{
+       if ((fd < 0) || (fd > MAX_DESCRIPTORS))
+               return false;
+       return ref[fd];
+}
+
+bool SocketEngine::DelFd(EventHandler* eh, bool force)
 {
        return true;
 }
@@ -78,7 +81,7 @@ int SocketEngine::GetRemainingFds()
        return 0;
 }
 
-int SocketEngine::Wait(int* fdlist)
+int SocketEngine::DispatchEvents()
 {
        return 0;
 }
@@ -87,3 +90,4 @@ std::string SocketEngine::GetName()
 {
        return "misconfigured";
 }
+