diff options
author | burlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-07-23 00:37:03 +0000 |
---|---|---|
committer | burlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-07-23 00:37:03 +0000 |
commit | 480e1e9e1ff6c39a154f3efc6e83b0ffc94a6c8d (patch) | |
tree | 3df6571bceabfe0d5b24e8a8aaafe7f1af3882d0 /src/inspsocket.cpp | |
parent | 3e5634346e5a0fa18d727079e88432e9a7aa0ec0 (diff) |
* Sockets will now always be nonblocking on win32 version of InspIRCd. There were some cases (mainly in TreeSockets) where a socket would not get restored to nonblocking mode after a connect() call, resulting in the server getting stuck on a blocking send() call causing freezeups.
* configure will now compile under VC7 again.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7500 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r-- | src/inspsocket.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index ecf7e0b24..edb58a05c 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -149,8 +149,8 @@ void InspSocket::SetQueues(int nfd) // attempt to increase socket sendq and recvq as high as its possible int sendbuf = 32768; int recvbuf = 32768; - setsockopt(nfd,SOL_SOCKET,SO_SNDBUF,(const char *)&sendbuf,sizeof(sendbuf)); - setsockopt(nfd,SOL_SOCKET,SO_RCVBUF,(const char *)&recvbuf,sizeof(sendbuf)); + if(setsockopt(nfd,SOL_SOCKET,SO_SNDBUF,(const char *)&sendbuf,sizeof(sendbuf)) || setsockopt(nfd,SOL_SOCKET,SO_RCVBUF,(const char *)&recvbuf,sizeof(sendbuf))) + this->Instance->Log(DEFAULT, "Could not increase SO_SNDBUF/SO_RCVBUF for socket %u", GetFd()); } /* Most irc servers require you to specify the ip you want to bind to. @@ -320,6 +320,11 @@ bool InspSocket::DoConnect() this->Timeout = new SocketTimeout(this->GetFd(), this->Instance, this, timeout_val, this->Instance->Time()); this->Instance->Timers->AddTimer(this->Timeout); } +#ifdef WIN32 + /* Set nonblocking mode after the connect() call */ + flags = 0; + ioctlsocket(this->fd, FIONBIO, &flags); +#endif this->state = I_CONNECTING; if (this->fd > -1) { |