diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-01 20:18:10 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-01 20:18:10 +0000 |
commit | 9c9968229fd0cc3ae346369772b41c9dbd857873 (patch) | |
tree | 38c2b6adcfd0784034385384cca99a60c732867c /src/inspsocket.cpp | |
parent | f40ede375016051d9026710122a40a5bbdd93c9f (diff) |
Much more detailed logging of lowlevel socket errors to the +l snomask
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6856 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r-- | src/inspsocket.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index cdc0dc26f..3face10f6 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -119,10 +119,10 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool if (!ipvalid) { this->Instance->Log(DEBUG,"BUG: Hostname passed to InspSocket, rather than an IP address!"); + this->OnError(I_ERR_CONNECT); this->Close(); this->fd = -1; this->state = I_ERROR; - this->OnError(I_ERR_RESOLVE); return; } else @@ -131,10 +131,10 @@ InspSocket::InspSocket(InspIRCd* SI, const std::string &ipaddr, int aport, bool timeout_val = maxtime; if (!this->DoConnect()) { + this->OnError(I_ERR_CONNECT); this->Close(); this->fd = -1; this->state = I_ERROR; - this->OnError(I_ERR_CONNECT); return; } } @@ -715,6 +715,23 @@ void InspSocket::HandleEvent(EventType et, int errornum) switch (et) { case EVENT_ERROR: + switch (errornum) + { + case ETIMEDOUT: + this->OnError(I_ERR_TIMEOUT); + break; + case ECONNREFUSED: + case 0: + this->OnError(this->state == I_CONNECTING ? I_ERR_CONNECT : I_ERR_WRITE); + break; + case EADDRINUSE: + this->OnError(I_ERR_BIND); + break; + case EPIPE: + case EIO: + this->OnError(I_ERR_WRITE); + break; + } if (this->Instance->SocketCull.find(this) == this->Instance->SocketCull.end()) this->Instance->SocketCull[this] = this; return; |