diff options
Diffstat (limited to 'src/stable/tcpserversocket.cpp')
-rw-r--r-- | src/stable/tcpserversocket.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
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 @@ | |||
5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "bu/config.h" | ||
9 | |||
8 | #ifndef WIN32 | 10 | #ifndef WIN32 |
9 | #include <sys/socket.h> | 11 | #include <sys/socket.h> |
10 | #include <netinet/in.h> | 12 | #include <netinet/in.h> |
@@ -23,8 +25,6 @@ | |||
23 | #include <fcntl.h> | 25 | #include <fcntl.h> |
24 | #include "bu/tcpserversocket.h" | 26 | #include "bu/tcpserversocket.h" |
25 | 27 | ||
26 | #include "bu/config.h" | ||
27 | |||
28 | namespace Bu { subExceptionDef( TcpServerSocketException ) } | 28 | namespace Bu { subExceptionDef( TcpServerSocketException ) } |
29 | 29 | ||
30 | Bu::TcpServerSocket::TcpServerSocket( int nPort, int nPoolSize ) : | 30 | Bu::TcpServerSocket::TcpServerSocket( int nPort, int nPoolSize ) : |
@@ -72,7 +72,7 @@ Bu::TcpServerSocket::TcpServerSocket(const String &sAddr,int nPort, int nPoolSiz | |||
72 | startServer( name, nPoolSize ); | 72 | startServer( name, nPoolSize ); |
73 | } | 73 | } |
74 | 74 | ||
75 | Bu::TcpServerSocket::TcpServerSocket( int nServer, bool bInit, int nPoolSize ) : | 75 | Bu::TcpServerSocket::TcpServerSocket( socket_t nServer, bool bInit, int nPoolSize ) : |
76 | nServer( nServer ), | 76 | nServer( nServer ), |
77 | nPort( 0 ) | 77 | nPort( 0 ) |
78 | { | 78 | { |
@@ -109,7 +109,11 @@ Bu::TcpServerSocket::TcpServerSocket( const TcpServerSocket &rSrc ) | |||
109 | 109 | ||
110 | Bu::TcpServerSocket::~TcpServerSocket() | 110 | Bu::TcpServerSocket::~TcpServerSocket() |
111 | { | 111 | { |
112 | #ifdef WIN32 | ||
113 | if( nServer != INVALID_SOCKET ) | ||
114 | #else | ||
112 | if( nServer > -1 ) | 115 | if( nServer > -1 ) |
116 | #endif | ||
113 | ::close( nServer ); | 117 | ::close( nServer ); |
114 | } | 118 | } |
115 | 119 | ||
@@ -118,7 +122,11 @@ void Bu::TcpServerSocket::startServer( struct sockaddr_in &name, int nPoolSize ) | |||
118 | /* Create the socket. */ | 122 | /* Create the socket. */ |
119 | nServer = bu_socket( PF_INET, SOCK_STREAM, 0 ); | 123 | nServer = bu_socket( PF_INET, SOCK_STREAM, 0 ); |
120 | 124 | ||
125 | #ifdef WIN32 | ||
126 | if( nServer == INVALID_SOCKET ) | ||
127 | #else | ||
121 | if( nServer < 0 ) | 128 | if( nServer < 0 ) |
129 | #endif | ||
122 | { | 130 | { |
123 | throw Bu::TcpServerSocketException("Couldn't create a listen socket."); | 131 | throw Bu::TcpServerSocketException("Couldn't create a listen socket."); |
124 | } | 132 | } |