diff options
-rw-r--r-- | src/inspsocket.cpp | 9 | ||||
-rw-r--r-- | src/socketengine_iocp.cpp | 12 | ||||
-rw-r--r-- | win/configure.cpp | 2 | ||||
-rw-r--r-- | win/m_spanningtreeVC71.vcproj | 2 |
4 files changed, 22 insertions, 3 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) { diff --git a/src/socketengine_iocp.cpp b/src/socketengine_iocp.cpp index ff1c7a0bc..c5c589e5f 100644 --- a/src/socketengine_iocp.cpp +++ b/src/socketengine_iocp.cpp @@ -333,7 +333,19 @@ void IOCPEngine::PostAcceptEvent(EventHandler * eh) if (!eh) return; + int on = 1; + u_long arg = 1; + struct linger linger = { 0 }; + int fd = WSASocket(AF_INET, SOCK_STREAM, 0, 0, 0, WSA_FLAG_OVERLAPPED); + + 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)); + ioctlsocket(fd, FIONBIO, &arg); + int len = sizeof(sockaddr_in) + 16; DWORD dwBytes; accept_overlap* ao = new accept_overlap; diff --git a/win/configure.cpp b/win/configure.cpp index adb10a6b9..a66e26118 100644 --- a/win/configure.cpp +++ b/win/configure.cpp @@ -13,10 +13,12 @@ #define _CRT_SECURE_NO_DEPRECATE +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdio.h> #include <string> #include <time.h> +#include "inspircd_win32wrapper.h" #include "colours.h" using namespace std; diff --git a/win/m_spanningtreeVC71.vcproj b/win/m_spanningtreeVC71.vcproj index 53eeb4c4b..532cefba8 100644 --- a/win/m_spanningtreeVC71.vcproj +++ b/win/m_spanningtreeVC71.vcproj @@ -65,7 +65,7 @@ <Configuration
Name="Release|Win32"
OutputDirectory="..\bin\release\modules"
- IntermediateDirectory="Release"
+ IntermediateDirectory="Release_spanningtree"
ConfigurationType="2"
CharacterSet="2">
<Tool
|