diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-06-18 22:44:45 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-06-18 22:44:45 +0000 |
commit | 33012c4ef4d39efad4fbc2b19f494f5c860fff51 (patch) | |
tree | 8bef67016807893f32b5a4d6aa822c65534500a5 /src/server.cpp | |
parent | 6f94639a3f5e20e1c635b2d8676086464d7cba2e (diff) | |
download | libbu++-33012c4ef4d39efad4fbc2b19f494f5c860fff51.tar.gz libbu++-33012c4ef4d39efad4fbc2b19f494f5c860fff51.tar.bz2 libbu++-33012c4ef4d39efad4fbc2b19f494f5c860fff51.tar.xz libbu++-33012c4ef4d39efad4fbc2b19f494f5c860fff51.zip |
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.
Diffstat (limited to '')
-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 ) |