diff options
Diffstat (limited to 'src/server.cpp')
| -rw-r--r-- | src/server.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp index 804bbcc..b7dec41 100644 --- a/src/server.cpp +++ b/src/server.cpp | |||
| @@ -14,7 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | Bu::Server::Server() : | 15 | Bu::Server::Server() : |
| 16 | nTimeoutSec( 0 ), | 16 | nTimeoutSec( 0 ), |
| 17 | nTimeoutUSec( 0 ) | 17 | nTimeoutUSec( 0 ), |
| 18 | bAutoTick( false ) | ||
| 18 | { | 19 | { |
| 19 | FD_ZERO( &fdActive ); | 20 | FD_ZERO( &fdActive ); |
| 20 | } | 21 | } |
| @@ -123,6 +124,9 @@ void Bu::Server::scan() | |||
| 123 | hClients.erase( *i ); | 124 | hClients.erase( *i ); |
| 124 | FD_CLR( *i, &fdActive ); | 125 | FD_CLR( *i, &fdActive ); |
| 125 | } | 126 | } |
| 127 | |||
| 128 | if( bAutoTick ) | ||
| 129 | tick(); | ||
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | void Bu::Server::addClient( int nSocket, int nPort ) | 132 | void Bu::Server::addClient( int nSocket, int nPort ) |
| @@ -166,3 +170,16 @@ Bu::ClientLink *Bu::Server::SrvClientLinkFactory::createLink( | |||
| 166 | return new SrvClientLink( pClient ); | 170 | return new SrvClientLink( pClient ); |
| 167 | } | 171 | } |
| 168 | 172 | ||
| 173 | void Bu::Server::setAutoTick( bool bEnable ) | ||
| 174 | { | ||
| 175 | bAutoTick = bEnable; | ||
| 176 | } | ||
| 177 | |||
| 178 | void Bu::Server::tick() | ||
| 179 | { | ||
| 180 | for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ ) | ||
| 181 | { | ||
| 182 | (*i)->tick(); | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
