From 33012c4ef4d39efad4fbc2b19f494f5c860fff51 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 18 Jun 2007 22:44:45 +0000 Subject: The client/server system now works both ways, in and out, and works as well as the old one in pretty much every way, and better in most. It's much easier to understand. And the atom class is better. --- src/server.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/server.cpp') 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() } else { - hClients.get( j )->processInput(); + Client *pClient = hClients.get( j ); + pClient->processInput(); + if( !pClient->isOpen() ) + { + onClosedConnection( pClient ); + hClients.erase( j ); + FD_CLR( j, &fdActive ); + } } } } + + // Now we just try to write all the pending data on all the sockets. + // this could be done better eventually, if we care about the socket + // wanting to accept writes (using a select). + for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ ) + { + (*i)->processOutput(); + } } void Bu::Server::addClient( int nSocket, int nPort ) -- cgit v1.2.3