From 800f02e7599d5f90d1c16f02cb1c28901d354140 Mon Sep 17 00:00:00 2001 From: danieldg Date: Fri, 13 Nov 2009 20:23:11 +0000 Subject: Get rid of socklen_t parameter to Bind, we are using C++ here and can do it other ways git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12129 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspsocket.cpp | 2 +- src/listensocket.cpp | 2 +- src/modules/m_ident.cpp | 5 ++--- src/socket.cpp | 2 +- src/socketengine.cpp | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 59f814cc9..6b3583a6a 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -90,7 +90,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const irc::sockets::sockaddrs& if (bind.sa.sa_family != 0) { - if (ServerInstance->SE->Bind(fd, &bind.sa, sa_size(bind)) < 0) + if (ServerInstance->SE->Bind(fd, bind) < 0) return I_ERR_BIND; } diff --git a/src/listensocket.cpp b/src/listensocket.cpp index 676898647..f0daf8ef0 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -36,7 +36,7 @@ ListenSocket::ListenSocket(ConfigTag* tag, const std::string& addr, int port) if (this->fd > -1) { ServerInstance->SE->SetReuse(fd); - int rv = ServerInstance->SE->Bind(this->fd, &bind_to.sa, sizeof(bind_to)); + int rv = ServerInstance->SE->Bind(this->fd, bind_to); if (rv >= 0) rv = ServerInstance->SE->Listen(this->fd, ServerInstance->Config->MaxConn); diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index fbd7706fe..ad62c77f9 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -83,7 +83,6 @@ class IdentRequestSocket : public EventHandler IdentRequestSocket(LocalUser* u) : user(u), result(u->ident) { age = ServerInstance->Time(); - socklen_t size = 0; SetFd(socket(user->server_sa.sa.sa_family, SOCK_STREAM, 0)); @@ -110,7 +109,7 @@ class IdentRequestSocket : public EventHandler } /* Attempt to bind (ident requests must come from the ip the query is referring to */ - if (ServerInstance->SE->Bind(GetFd(), &bindaddr.sa, size) < 0) + if (ServerInstance->SE->Bind(GetFd(), bindaddr) < 0) { this->Close(); throw ModuleException("failed to bind()"); @@ -119,7 +118,7 @@ class IdentRequestSocket : public EventHandler ServerInstance->SE->NonBlocking(GetFd()); /* Attempt connection (nonblocking) */ - if (ServerInstance->SE->Connect(this, &connaddr.sa, size) == -1 && errno != EINPROGRESS) + if (ServerInstance->SE->Connect(this, &connaddr.sa, connaddr.sa_size()) == -1 && errno != EINPROGRESS) { this->Close(); throw ModuleException("connect() failed"); diff --git a/src/socket.cpp b/src/socket.cpp index eb47c9cc8..049d3a237 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -36,7 +36,7 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) else if (!irc::sockets::aptosa(addr, port, servaddr)) return false; - ret = SE->Bind(sockfd, &servaddr.sa, sa_size(servaddr)); + ret = SE->Bind(sockfd, servaddr); if (ret < 0) { diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 478400d1b..b442732f5 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -197,9 +197,9 @@ int SocketEngine::Shutdown(EventHandler* fd, int how) return shutdown(fd->GetFd(), how); } -int SocketEngine::Bind(int fd, const sockaddr *my_addr, socklen_t addrlen) +int SocketEngine::Bind(int fd, const irc::sockets::sockaddrs& addr) { - return bind(fd, my_addr, addrlen); + return bind(fd, &addr.sa, addr.sa_size()); } int SocketEngine::Listen(int sockfd, int backlog) -- cgit v1.2.3