diff options
-rw-r--r-- | include/socketengine.h | 5 | ||||
-rw-r--r-- | src/inspsocket.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_ident.cpp | 2 | ||||
-rw-r--r-- | src/socketengine.cpp | 4 |
4 files changed, 6 insertions, 7 deletions
diff --git a/include/socketengine.h b/include/socketengine.h index 0187a043e..8549da612 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -493,11 +493,10 @@ public: /** Abstraction for BSD sockets connect(2). * This function should emulate its namesake system call exactly. * @param fd This version of the call takes an EventHandler instead of a bare file descriptor. - * @param serv_addr The server IP address and port. - * @param addrlen The size of the sockaddr parameter. + * @param address The server IP address and port. * @return This method should return exactly the same values as the system call it emulates. */ - static int Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen); + static int Connect(EventHandler* fd, const irc::sockets::sockaddrs& address); /** Make a file descriptor blocking. * @param fd a file descriptor to set to blocking mode diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index a564d3eec..709ad443b 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -96,7 +96,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const irc::sockets::sockaddrs& SocketEngine::NonBlocking(fd); - if (SocketEngine::Connect(this, &dest.sa, dest.sa_size()) == -1) + if (SocketEngine::Connect(this, dest) == -1) { if (errno != EINPROGRESS) return I_ERR_CONNECT; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 806c70ad2..4b110ccd6 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -126,7 +126,7 @@ class IdentRequestSocket : public EventHandler SocketEngine::NonBlocking(GetFd()); /* Attempt connection (nonblocking) */ - if (SocketEngine::Connect(this, &connaddr.sa, connaddr.sa_size()) == -1 && errno != EINPROGRESS) + if (SocketEngine::Connect(this, connaddr) == -1 && errno != EINPROGRESS) { this->Close(); throw ModuleException("connect() failed"); diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 986726f3a..e02261bad 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -277,9 +277,9 @@ int SocketEngine::WriteV(EventHandler* fd, const iovec* iovec, int count) } #endif -int SocketEngine::Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen) +int SocketEngine::Connect(EventHandler* fd, const irc::sockets::sockaddrs& address) { - int ret = connect(fd->GetFd(), serv_addr, addrlen); + int ret = connect(fd->GetFd(), &address.sa, address.sa_size()); #ifdef _WIN32 if ((ret == SOCKET_ERROR) && (WSAGetLastError() == WSAEWOULDBLOCK)) errno = EINPROGRESS; |