summaryrefslogtreecommitdiff
path: root/src/unstable/itoserver.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-08-28 17:42:54 +0000
committerMike Buland <eichlan@xagasoft.com>2012-08-28 17:42:54 +0000
commit411cdf39fc2b961a970a0ae91b9059614251247e (patch)
tree935afa56c11aef0fb769e63659970e7d033a99e8 /src/unstable/itoserver.cpp
parentfc5132d68ae9e6afdbd0b5a687ba81c88fc84826 (diff)
downloadlibbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.gz
libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.bz2
libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.tar.xz
libbu++-411cdf39fc2b961a970a0ae91b9059614251247e.zip
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().
Diffstat (limited to '')
-rw-r--r--src/unstable/itoserver.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/unstable/itoserver.cpp b/src/unstable/itoserver.cpp
index 5b3b5a2..7dbce6c 100644
--- a/src/unstable/itoserver.cpp
+++ b/src/unstable/itoserver.cpp
@@ -5,14 +5,13 @@
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"
8#include "bu/itoserver.h" 9#include "bu/itoserver.h"
9#include <errno.h> 10#include <errno.h>
10#include "bu/tcpserversocket.h" 11#include "bu/tcpserversocket.h"
11#include "bu/client.h" 12#include "bu/client.h"
12#include "bu/tcpsocket.h" 13#include "bu/tcpsocket.h"
13 14
14#include "bu/config.h"
15
16Bu::ItoServer::ItoServer() : 15Bu::ItoServer::ItoServer() :
17 nTimeoutSec( 1 ), 16 nTimeoutSec( 1 ),
18 nTimeoutUSec( 0 ) 17 nTimeoutUSec( 0 )
@@ -42,7 +41,7 @@ Bu::ItoServer::~ItoServer()
42void Bu::ItoServer::addPort( int nPort, int nPoolSize ) 41void Bu::ItoServer::addPort( int nPort, int nPoolSize )
43{ 42{
44 TcpServerSocket *s = new TcpServerSocket( nPort, nPoolSize ); 43 TcpServerSocket *s = new TcpServerSocket( nPort, nPoolSize );
45 int nSocket = s->getSocket(); 44 socket_t nSocket = s->getSocket();
46 FD_SET( nSocket, &fdActive ); 45 FD_SET( nSocket, &fdActive );
47 hServers.insert( nSocket, s ); 46 hServers.insert( nSocket, s );
48} 47}
@@ -50,7 +49,7 @@ void Bu::ItoServer::addPort( int nPort, int nPoolSize )
50void Bu::ItoServer::addPort( const String &sAddr, int nPort, int nPoolSize ) 49void Bu::ItoServer::addPort( const String &sAddr, int nPort, int nPoolSize )
51{ 50{
52 TcpServerSocket *s = new TcpServerSocket( sAddr, nPort, nPoolSize ); 51 TcpServerSocket *s = new TcpServerSocket( sAddr, nPort, nPoolSize );
53 int nSocket = s->getSocket(); 52 socket_t nSocket = s->getSocket();
54 FD_SET( nSocket, &fdActive ); 53 FD_SET( nSocket, &fdActive );
55 hServers.insert( nSocket, s ); 54 hServers.insert( nSocket, s );
56} 55}
@@ -61,7 +60,7 @@ void Bu::ItoServer::setTimeout( int nTimeoutSec, int nTimeoutUSec )
61 this->nTimeoutUSec = nTimeoutUSec; 60 this->nTimeoutUSec = nTimeoutUSec;
62} 61}
63 62
64void Bu::ItoServer::addClient( int nSocket, int nPort ) 63void Bu::ItoServer::addClient( socket_t nSocket, int nPort )
65{ 64{
66 ItoClient *pC = new ItoClient( *this, nSocket, nPort, nTimeoutSec, 65 ItoClient *pC = new ItoClient( *this, nSocket, nPort, nTimeoutSec,
67 nTimeoutUSec ); 66 nTimeoutUSec );
@@ -106,7 +105,7 @@ void Bu::ItoServer::run()
106 } 105 }
107} 106}
108 107
109void Bu::ItoServer::clientCleanup( int iSocket ) 108void Bu::ItoServer::clientCleanup( socket_t iSocket )
110{ 109{
111 imClients.lock(); 110 imClients.lock();
112 ItoClient *pCli = hClients.get( iSocket ); 111 ItoClient *pCli = hClients.get( iSocket );
@@ -114,7 +113,7 @@ void Bu::ItoServer::clientCleanup( int iSocket )
114 qClientCleanup.enqueue( pCli ); 113 qClientCleanup.enqueue( pCli );
115} 114}
116 115
117Bu::ItoServer::ItoClient::ItoClient( ItoServer &rSrv, int iSocket, int iPort, 116Bu::ItoServer::ItoClient::ItoClient( ItoServer &rSrv, Bu::ItoServer::socket_t iSocket, int iPort,
118 int nTimeoutSec, int nTimeoutUSec ) : 117 int nTimeoutSec, int nTimeoutUSec ) :
119 rSrv( rSrv ), 118 rSrv( rSrv ),
120 iSocket( iSocket ), 119 iSocket( iSocket ),