diff options
| author | 2010-02-17 17:22:23 -0600 | |
|---|---|---|
| committer | 2010-08-03 17:32:36 -0400 | |
| commit | 0584675861f05321b89fff44fda38ebd49006e54 (patch) | |
| tree | a8cd3ac16fc68d78aeacfb9d1c745cf8311f0bdb /src/inspsocket.cpp | |
| parent | Remove useless return value from OnUserRegister (diff) | |
New I/O hook API
This removes some pointless Module:: entries, uses the ServiceProvider
lookup API for bind tags, and allows GnuTLS to use custom certificates
per bind or link block using:
<bind ssl="gnutls" ssl_cert="signed" ...>
<ssl_cert name="signed" certfile="my.cert.pem" keyfile="my.key.pem">
Diffstat (limited to 'src/inspsocket.cpp')
| -rw-r--r-- | src/inspsocket.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 65b554006..ce301ffa9 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -122,18 +122,19 @@ void StreamSocket::Close() { // final chance, dump as much of the sendq as we can DoWrite(); - if (IOHook) + if (hook) { try { - IOHook->OnStreamSocketClose(this); + hook->OnClose(this); } catch (CoreException& modexcept) { ServerInstance->Logs->Log("SOCKET", DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } - IOHook = NULL; + delete hook; + hook = NULL; } 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 (hook) { int rv = -1; try { - rv = IOHook->OnStreamSocketRead(this, recvq); + rv = hook->OnRead(this, recvq); } catch (CoreException& modexcept) { @@ -227,7 +228,7 @@ void StreamSocket::DoWrite() } #ifndef DISABLE_WRITEV - if (IOHook) + if (hook) #endif { int rv = -1; @@ -253,9 +254,9 @@ void StreamSocket::DoWrite() } std::string& front = sendq.front(); int itemlen = front.length(); - if (IOHook) + if (hook) { - rv = IOHook->OnStreamSocketWrite(this, front); + rv = hook->OnWrite(this, front); if (rv > 0) { // consumed the entire string, and is ready for more @@ -465,10 +466,7 @@ void BufferedSocket::DoWrite() { state = I_CONNECTED; this->OnConnected(); - if (GetIOHook()) - GetIOHook()->OnStreamSocketConnect(this); - else - ServerInstance->SE->ChangeEventMask(this, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE); + ServerInstance->SE->ChangeEventMask(this, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE); } this->StreamSocket::DoWrite(); } |
