diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-24 20:04:15 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-24 20:04:15 +0000 |
commit | 9c67795e733c553ff6b05398501d402c46349199 (patch) | |
tree | 06425c63f2fba3a83335da27188b013574f5fdc6 /src/socketengine.cpp | |
parent | 9fad3ecb9215a0034bf407f192926b04cb5efaed (diff) |
Get rid of OpenTCPSocket
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11969 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengine.cpp')
-rw-r--r-- | src/socketengine.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 2dbc82b27..478400d1b 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -152,9 +152,15 @@ int SocketEngine::NonBlocking(int fd) #endif } -int SocketEngine::GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namelen) -{ - return getsockname(fd->GetFd(), name, namelen); +void SocketEngine::SetReuse(int fd) +{ + int on = 1; + struct linger linger = { 0, 0 }; + setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on)); + /* This is BSD compatible, setting l_onoff to 0 is *NOT* http://web.irc.org/mla/ircd-dev/msg02259.html */ + linger.l_onoff = 1; + linger.l_linger = 1; + setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(linger)); } int SocketEngine::RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, sockaddr *from, socklen_t *fromlen) |