summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 53b4301..29d4822 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -74,12 +74,26 @@ void Bu::Server::scan()
74 } 74 }
75 } 75 }
76 76
77 Bu::List<int> lDelete;
77 // Now we just try to write all the pending data on all the sockets. 78 // Now we just try to write all the pending data on all the sockets.
78 // this could be done better eventually, if we care about the socket 79 // this could be done better eventually, if we care about the socket
79 // wanting to accept writes (using a select). 80 // wanting to accept writes (using a select).
80 for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ ) 81 for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ )
81 { 82 {
82 (*i)->processOutput(); 83 (*i)->processOutput();
84 if( (*i)->wantsDisconnect() )
85 {
86 lDelete.append( i.getKey() );
87 }
88 }
89
90 for( Bu::List<int>::iterator i = lDelete.begin(); i != lDelete.end(); i++ )
91 {
92 Client *pClient = hClients.get( *i );
93 onClosedConnection( pClient );
94 pClient->close();
95 hClients.erase( *i );
96 FD_CLR( *i, &fdActive );
83 } 97 }
84} 98}
85 99