From 411cdf39fc2b961a970a0ae91b9059614251247e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 28 Aug 2012 17:42:54 +0000 Subject: Loads of win32 compilation issues fixed. Most are fairly minor unsigned/signed mismatches because of socket handles, but there were also some order-of-definition issues that were fixed in the FD_SETSIZE definition code. Fixed a few things that just never worked on windows, like Bu::Thread::yield(). --- src/stable/tcpserversocket.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/stable/tcpserversocket.cpp') diff --git a/src/stable/tcpserversocket.cpp b/src/stable/tcpserversocket.cpp index daedcd1..91da199 100644 --- a/src/stable/tcpserversocket.cpp +++ b/src/stable/tcpserversocket.cpp @@ -5,6 +5,8 @@ * terms of the license contained in the file LICENSE. */ +#include "bu/config.h" + #ifndef WIN32 #include #include @@ -23,8 +25,6 @@ #include #include "bu/tcpserversocket.h" -#include "bu/config.h" - namespace Bu { subExceptionDef( TcpServerSocketException ) } Bu::TcpServerSocket::TcpServerSocket( int nPort, int nPoolSize ) : @@ -72,7 +72,7 @@ Bu::TcpServerSocket::TcpServerSocket(const String &sAddr,int nPort, int nPoolSiz startServer( name, nPoolSize ); } -Bu::TcpServerSocket::TcpServerSocket( int nServer, bool bInit, int nPoolSize ) : +Bu::TcpServerSocket::TcpServerSocket( socket_t nServer, bool bInit, int nPoolSize ) : nServer( nServer ), nPort( 0 ) { @@ -109,7 +109,11 @@ Bu::TcpServerSocket::TcpServerSocket( const TcpServerSocket &rSrc ) Bu::TcpServerSocket::~TcpServerSocket() { +#ifdef WIN32 + if( nServer != INVALID_SOCKET ) +#else if( nServer > -1 ) +#endif ::close( nServer ); } @@ -118,7 +122,11 @@ void Bu::TcpServerSocket::startServer( struct sockaddr_in &name, int nPoolSize ) /* Create the socket. */ nServer = bu_socket( PF_INET, SOCK_STREAM, 0 ); +#ifdef WIN32 + if( nServer == INVALID_SOCKET ) +#else if( nServer < 0 ) +#endif { throw Bu::TcpServerSocketException("Couldn't create a listen socket."); } -- cgit v1.2.3