diff options
Diffstat (limited to 'src/server.cpp')
| -rw-r--r-- | src/server.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp index bceeb81..d07a597 100644 --- a/src/server.cpp +++ b/src/server.cpp | |||
| @@ -61,10 +61,25 @@ void Bu::Server::scan() | |||
| 61 | } | 61 | } |
| 62 | else | 62 | else |
| 63 | { | 63 | { |
| 64 | hClients.get( j )->processInput(); | 64 | Client *pClient = hClients.get( j ); |
| 65 | pClient->processInput(); | ||
| 66 | if( !pClient->isOpen() ) | ||
| 67 | { | ||
| 68 | onClosedConnection( pClient ); | ||
| 69 | hClients.erase( j ); | ||
| 70 | FD_CLR( j, &fdActive ); | ||
| 71 | } | ||
| 65 | } | 72 | } |
| 66 | } | 73 | } |
| 67 | } | 74 | } |
| 75 | |||
| 76 | // Now we just try to write all the pending data on all the sockets. | ||
| 77 | // this could be done better eventually, if we care about the socket | ||
| 78 | // wanting to accept writes (using a select). | ||
| 79 | for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ ) | ||
| 80 | { | ||
| 81 | (*i)->processOutput(); | ||
| 82 | } | ||
| 68 | } | 83 | } |
| 69 | 84 | ||
| 70 | void Bu::Server::addClient( int nSocket, int nPort ) | 85 | void Bu::Server::addClient( int nSocket, int nPort ) |
