diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-05-24 19:34:25 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-06-07 01:00:10 +0200 |
commit | 79db1cf848c64ba50bebadef4c683ae4237080b7 (patch) | |
tree | fcaed0d8034d5e750de24cb1cd9ee87570816d66 /src/inspsocket.cpp | |
parent | f2febe8ff61766f1b57305fae873071de4526d58 (diff) |
Create IOHook interface (extracted from Module)
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r-- | src/inspsocket.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 3a8a58b5f..ec528571b 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -26,6 +26,7 @@ #include "socket.h" #include "inspstring.h" #include "socketengine.h" +#include "iohook.h" #ifndef DISABLE_WRITEV #include <sys/uio.h> @@ -122,18 +123,18 @@ void StreamSocket::Close() { // final chance, dump as much of the sendq as we can DoWrite(); - if (IOHook) + if (GetIOHook()) { try { - IOHook->OnStreamSocketClose(this); + GetIOHook()->OnStreamSocketClose(this); } catch (CoreException& modexcept) { ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } - IOHook = NULL; + DelIOHook(); } ServerInstance->SE->Shutdown(this, 2); ServerInstance->SE->DelFd(this); @@ -161,12 +162,12 @@ bool StreamSocket::GetNextLine(std::string& line, char delim) void StreamSocket::DoRead() { - if (IOHook) + if (GetIOHook()) { int rv = -1; try { - rv = IOHook->OnStreamSocketRead(this, recvq); + rv = GetIOHook()->OnStreamSocketRead(this, recvq); } catch (CoreException& modexcept) { @@ -230,7 +231,7 @@ void StreamSocket::DoWrite() } #ifndef DISABLE_WRITEV - if (IOHook) + if (GetIOHook()) #endif { int rv = -1; @@ -256,9 +257,9 @@ void StreamSocket::DoWrite() } std::string& front = sendq.front(); int itemlen = front.length(); - if (IOHook) + if (GetIOHook()) { - rv = IOHook->OnStreamSocketWrite(this, front); + rv = GetIOHook()->OnStreamSocketWrite(this, front); if (rv > 0) { // consumed the entire string, and is ready for more |