+int CONFIGPROTO::MaxFD() const
+{
+ int maxFD = m_listenSocket;
+ for (size_t i = 0; i < m_conns.size(); ++i)
+ if (maxFD < m_conns[i]->Sock())
+ maxFD = m_conns[i]->Sock();
+ return maxFD;
+}
+
+void CONFIGPROTO::BuildFDSet(fd_set & fds) const
+{
+ for (size_t i = 0; i < m_conns.size(); ++i)
+ FD_SET(m_conns[i]->Sock(), &fds);
+}
+
+void CONFIGPROTO::CleanupConns()
+{
+ std::vector<STG::Conn *>::iterator pos;
+ pos = std::remove_if(m_conns.begin(), m_conns.end(), IsFinished());
+ if (pos == m_conns.end())
+ return;
+ std::for_each(pos, m_conns.end(), RemoveConn());
+ m_conns.erase(pos, m_conns.end());
+}
+
+void CONFIGPROTO::HandleEvents(const fd_set & fds)
+{
+ if (FD_ISSET(m_listenSocket, &fds))
+ AcceptConnection();
+ else
+ {
+ for (size_t i = 0; i < m_conns.size(); ++i)
+ if (FD_ISSET(m_conns[i]->Sock(), &fds))
+ m_conns[i]->Read();
+ }
+}