diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-01-10 21:04:17 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-10 21:04:17 +0000 |
| commit | 2ba3f84ab559da02a11aa000b3cecb3b3668af61 (patch) | |
| tree | 266f450b512f607ec54d54af4fa8c13fdbe7ef91 /src/server.cpp | |
| parent | ea18007633b31901f2ae275cc0576c3f7ce99fc9 (diff) | |
| parent | 3611f253f6fdfa4954d374ab85ddaa7f799c130c (diff) | |
| download | libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.gz libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.bz2 libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.xz libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.zip | |
Merged in the core branch. This is a major update that fixes many things, and
changes many others, including source files that were deleted and renamed.
Before doing this update, I reccomend a full clean, or even a fresh checkout.
Things to note, most outstanding about this update:
- Bu::Socket was changed to Bu::TcpSocket and the default mode is blocking.
- All templatized container classes are SharedCore now, which is good, but
SharedCore is inherently non-reentrant safe. However, all SharedCore classes
have a "clone" function that return a non-shared copy of the object, safe for
passing into a reentrant safe function accessing shared memory.
Diffstat (limited to 'src/server.cpp')
| -rw-r--r-- | src/server.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/server.cpp b/src/server.cpp index 51c056a..e701a69 100644 --- a/src/server.cpp +++ b/src/server.cpp | |||
| @@ -8,9 +8,9 @@ | |||
| 8 | #include "bu/server.h" | 8 | #include "bu/server.h" |
| 9 | #include <errno.h> | 9 | #include <errno.h> |
| 10 | #include <unistd.h> | 10 | #include <unistd.h> |
| 11 | #include "bu/serversocket.h" | 11 | #include "bu/tcpserversocket.h" |
| 12 | #include "bu/client.h" | 12 | #include "bu/client.h" |
| 13 | #include "bu/socket.h" | 13 | #include "bu/tcpsocket.h" |
| 14 | #include "bu/config.h" | 14 | #include "bu/config.h" |
| 15 | 15 | ||
| 16 | Bu::Server::Server() : | 16 | Bu::Server::Server() : |
| @@ -28,7 +28,7 @@ Bu::Server::~Server() | |||
| 28 | 28 | ||
| 29 | void Bu::Server::addPort( int nPort, int nPoolSize ) | 29 | void Bu::Server::addPort( int nPort, int nPoolSize ) |
| 30 | { | 30 | { |
| 31 | ServerSocket *s = new ServerSocket( nPort, nPoolSize ); | 31 | TcpServerSocket *s = new TcpServerSocket( nPort, nPoolSize ); |
| 32 | int nSocket = s->getSocket(); | 32 | int nSocket = s->getSocket(); |
| 33 | FD_SET( nSocket, &fdActive ); | 33 | FD_SET( nSocket, &fdActive ); |
| 34 | hServers.insert( nSocket, s ); | 34 | hServers.insert( nSocket, s ); |
| @@ -36,7 +36,7 @@ void Bu::Server::addPort( int nPort, int nPoolSize ) | |||
| 36 | 36 | ||
| 37 | void Bu::Server::addPort( const FString &sAddr, int nPort, int nPoolSize ) | 37 | void Bu::Server::addPort( const FString &sAddr, int nPort, int nPoolSize ) |
| 38 | { | 38 | { |
| 39 | ServerSocket *s = new ServerSocket( sAddr, nPort, nPoolSize ); | 39 | TcpServerSocket *s = new TcpServerSocket( sAddr, nPort, nPoolSize ); |
| 40 | int nSocket = s->getSocket(); | 40 | int nSocket = s->getSocket(); |
| 41 | FD_SET( nSocket, &fdActive ); | 41 | FD_SET( nSocket, &fdActive ); |
| 42 | hServers.insert( nSocket, s ); | 42 | hServers.insert( nSocket, s ); |
| @@ -75,7 +75,7 @@ void Bu::Server::scan() | |||
| 75 | { | 75 | { |
| 76 | if( hServers.has( j ) ) | 76 | if( hServers.has( j ) ) |
| 77 | { | 77 | { |
| 78 | ServerSocket *pSrv = hServers.get( j ); | 78 | TcpServerSocket *pSrv = hServers.get( j ); |
| 79 | addClient( pSrv->accept(), pSrv->getPort() ); | 79 | addClient( pSrv->accept(), pSrv->getPort() ); |
| 80 | } | 80 | } |
| 81 | else | 81 | else |
| @@ -97,7 +97,7 @@ void Bu::Server::scan() | |||
| 97 | { | 97 | { |
| 98 | pClient->processOutput(); | 98 | pClient->processOutput(); |
| 99 | } | 99 | } |
| 100 | catch( Bu::SocketException &e ) | 100 | catch( Bu::TcpSocketException &e ) |
| 101 | { | 101 | { |
| 102 | closeClient( j ); | 102 | closeClient( j ); |
| 103 | } | 103 | } |
| @@ -136,7 +136,7 @@ void Bu::Server::addClient( int nSocket, int nPort ) | |||
| 136 | FD_SET( nSocket, &fdActive ); | 136 | FD_SET( nSocket, &fdActive ); |
| 137 | 137 | ||
| 138 | Client *c = new Client( | 138 | Client *c = new Client( |
| 139 | new Bu::Socket( nSocket ), | 139 | new Bu::TcpSocket( nSocket ), |
| 140 | new SrvClientLinkFactory() | 140 | new SrvClientLinkFactory() |
| 141 | ); | 141 | ); |
| 142 | hClients.insert( nSocket, c ); | 142 | hClients.insert( nSocket, c ); |
