From e2af2347fc035d702e45f12e772223a8d578410d Mon Sep 17 00:00:00 2001 From: danieldg Date: Mon, 21 Sep 2009 13:26:31 +0000 Subject: 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 --- src/socketengine.cpp | 61 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 59 deletions(-) (limited to 'src/socketengine.cpp') diff --git a/src/socketengine.cpp b/src/socketengine.cpp index af2f1b169..c0ae3f278 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -43,35 +43,7 @@ EventHandler::EventHandler() { - this->IOHook = NULL; -} - -bool EventHandler::AddIOHook(Module *IOHooker) -{ - if (this->IOHook) - return false; - - this->IOHook = IOHooker; - return true; -} - -bool EventHandler::DelIOHook() -{ - if (!this->IOHook) - return false; - - this->IOHook = NULL; - return true; -} - -Module *EventHandler::GetIOHook() -{ - return this->IOHook; -} - -int EventHandler::GetFd() -{ - return this->fd; + fd = -1; } void EventHandler::SetFd(int FD) @@ -79,21 +51,7 @@ void EventHandler::SetFd(int FD) this->fd = FD; } -bool EventHandler::Readable() -{ - return true; -} - -bool EventHandler::Writeable() -{ - return false; -} - -void SocketEngine::WantWrite(EventHandler* eh) -{ -} - -SocketEngine::SocketEngine(InspIRCd* Instance) : ServerInstance(Instance) +SocketEngine::SocketEngine() { TotalEvents = WriteEvents = ReadEvents = ErrorEvents = 0; lastempty = ServerInstance->Time(); @@ -104,11 +62,6 @@ SocketEngine::~SocketEngine() { } -bool SocketEngine::AddFd(EventHandler* eh) -{ - return true; -} - bool SocketEngine::HasFd(int fd) { if ((fd < 0) || (fd > MAX_DESCRIPTORS)) @@ -123,11 +76,6 @@ EventHandler* SocketEngine::GetRef(int fd) return ref[fd]; } -bool SocketEngine::DelFd(EventHandler* eh, bool force) -{ - return true; -} - int SocketEngine::GetMaxFds() { return 0; @@ -143,11 +91,6 @@ int SocketEngine::DispatchEvents() return 0; } -std::string SocketEngine::GetName() -{ - return "misconfigured"; -} - bool SocketEngine::BoundsCheckFd(EventHandler* eh) { if (!eh) -- cgit v1.2.3