diff options
author | Adam <Adam@anope.org> | 2011-07-31 04:00:35 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-07-31 04:00:35 -0400 |
commit | f32149117a0b32a26a7695760f29d1a2b10332c5 (patch) | |
tree | a7b31aaa2a059a69e8dbd013228c5af89cb7f7c2 /src/sockets.cpp | |
parent | 1cb11bba5dd36c2ac1f02e7b49c659de142ce481 (diff) |
Fixed error message from being unable to connect
Diffstat (limited to 'src/sockets.cpp')
-rw-r--r-- | src/sockets.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sockets.cpp b/src/sockets.cpp index 122d6b646..e95c9f7a9 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -324,7 +324,7 @@ void SocketIO::Connect(ConnectionSocket *s, const Anope::string &target, int por if (c == -1) { if (Anope::LastErrorCode() != EINPROGRESS) - throw SocketException("Error connecting to server: " + Anope::LastError()); + s->OnError(Anope::LastError()); else SocketEngine::MarkWritable(s); } @@ -718,6 +718,11 @@ bool ConnectionSocket::ProcessWrite() */ void ConnectionSocket::ProcessError() { + int optval = 0; + socklen_t optlen = sizeof(optval); + getsockopt(this->GetFD(), SOL_SOCKET, SO_ERROR, &optval, &optlen); + errno = optval; + this->OnError(optval ? Anope::LastError() : ""); } /** Called on a successful connect |