aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-03-08 23:16:35 +0000
committerMike Buland <eichlan@xagasoft.com>2010-03-08 23:16:35 +0000
commit3667cec1f612e6a37479f99bd1fa23d92af7cff7 (patch)
tree819f386631dd338b765165c3a5312ef65c06752c /src
parentd31d089ea7a0545c3e72584b572f9a21ae15f8b4 (diff)
downloadlibbu++-3667cec1f612e6a37479f99bd1fa23d92af7cff7.tar.gz
libbu++-3667cec1f612e6a37479f99bd1fa23d92af7cff7.tar.bz2
libbu++-3667cec1f612e6a37479f99bd1fa23d92af7cff7.tar.xz
libbu++-3667cec1f612e6a37479f99bd1fa23d92af7cff7.zip
Server socket has a few tweaks now.
Diffstat (limited to 'src')
-rw-r--r--src/nids.h6
-rw-r--r--src/serversocket.cpp16
2 files changed, 19 insertions, 3 deletions
diff --git a/src/nids.h b/src/nids.h
index 02d6cf4..0976e67 100644
--- a/src/nids.h
+++ b/src/nids.h
@@ -96,10 +96,10 @@ namespace Bu
96 /*uint32_t uPrevBlock,*/ bool bNew=false ); 96 /*uint32_t uPrevBlock,*/ bool bNew=false );
97 uint32_t createBlock( uint32_t uFirstBlock, /*uint32_t uPrevBlock,*/ 97 uint32_t createBlock( uint32_t uFirstBlock, /*uint32_t uPrevBlock,*/
98 int iPreAllocate=1 ); 98 int iPreAllocate=1 );
99 void getBlock( uint32_t uIndex, struct Nids::Block *pBlock ); 99 void getBlock( uint32_t uIndex, Block *pBlock );
100 void setBlock( uint32_t uIndex, struct Nids::Block *pBlock ); 100 void setBlock( uint32_t uIndex, Block *pBlock );
101 void updateStreamSize( uint32_t uIndex, uint32_t uSize ); 101 void updateStreamSize( uint32_t uIndex, uint32_t uSize );
102 uint32_t getNextBlock( uint32_t uIndex, struct Nids::Block *pBlock, 102 uint32_t getNextBlock( uint32_t uIndex, Block *pBlock,
103 bool bCreate=true); 103 bool bCreate=true);
104 104
105 void updateHeader(); 105 void updateHeader();
diff --git a/src/serversocket.cpp b/src/serversocket.cpp
index b711320..37eb3d4 100644
--- a/src/serversocket.cpp
+++ b/src/serversocket.cpp
@@ -31,6 +31,10 @@ namespace Bu { subExceptionDef( ServerSocketException ) }
31Bu::ServerSocket::ServerSocket( int nPort, int nPoolSize ) : 31Bu::ServerSocket::ServerSocket( int nPort, int nPoolSize ) :
32 nPort( nPort ) 32 nPort( nPort )
33{ 33{
34#ifdef WIN32
35 Bu::Winsock2::getInstance();
36#endif
37
34 /* Create the socket and set it up to accept connections. */ 38 /* Create the socket and set it up to accept connections. */
35 struct sockaddr_in name; 39 struct sockaddr_in name;
36 40
@@ -48,6 +52,10 @@ Bu::ServerSocket::ServerSocket( int nPort, int nPoolSize ) :
48Bu::ServerSocket::ServerSocket(const FString &sAddr,int nPort, int nPoolSize) : 52Bu::ServerSocket::ServerSocket(const FString &sAddr,int nPort, int nPoolSize) :
49 nPort( nPort ) 53 nPort( nPort )
50{ 54{
55#ifdef WIN32
56 Bu::Winsock2::getInstance();
57#endif
58
51 /* Create the socket and set it up to accept connections. */ 59 /* Create the socket and set it up to accept connections. */
52 struct sockaddr_in name; 60 struct sockaddr_in name;
53 61
@@ -69,6 +77,10 @@ Bu::ServerSocket::ServerSocket( int nServer, bool bInit, int nPoolSize ) :
69 nServer( nServer ), 77 nServer( nServer ),
70 nPort( 0 ) 78 nPort( 0 )
71{ 79{
80#ifdef WIN32
81 Bu::Winsock2::getInstance();
82#endif
83
72 if( bInit ) 84 if( bInit )
73 { 85 {
74 struct sockaddr name; 86 struct sockaddr name;
@@ -86,6 +98,10 @@ Bu::ServerSocket::ServerSocket( int nServer, bool bInit, int nPoolSize ) :
86 98
87Bu::ServerSocket::ServerSocket( const ServerSocket &rSrc ) 99Bu::ServerSocket::ServerSocket( const ServerSocket &rSrc )
88{ 100{
101#ifdef WIN32
102 Bu::Winsock2::getInstance();
103#endif
104
89 nServer = dup( rSrc.nServer ); 105 nServer = dup( rSrc.nServer );
90 nPort = rSrc.nPort; 106 nPort = rSrc.nPort;
91 FD_ZERO( &fdActive ); 107 FD_ZERO( &fdActive );