+void Server::cancel_keepalive(Response &resp)
+{
+ get_client_by_response(resp).keepalive = false;
+}
+
+void Server::close_connections(const Time::TimeDelta &timeout)
+{
+ IO::Poller poller;
+ for(list<Client>::iterator i=clients.begin(); i!=clients.end(); ++i)
+ {
+ i->sock->shutdown(IO::M_WRITE);
+ poller.set_object(*i->sock, IO::P_INPUT);
+ }
+
+ while(!clients.empty() && poller.poll(timeout))
+ {
+ const vector<IO::Poller::PolledObject> &result = poller.get_result();
+ for(vector<IO::Poller::PolledObject>::const_iterator i=result.begin(); i!=result.end(); ++i)
+ for(list<Client>::iterator j=clients.begin(); j!=clients.end(); ++j)
+ if(j->sock.get()==i->object)
+ {
+ poller.set_object(*j->sock, IO::P_NONE);
+ clients.erase(j);
+ break;
+ }
+ }
+}
+