void WebServerBaseClass::run(void) { int nl; if (m_connections->GetSize() < m_max_con && (nl=m_listeners->GetSize())) { JNL_Listen *l=(JNL_Listen *)m_listeners->Get(m_listener_rot++ % nl); JNL_IConnection *c=l->get_connect(); if (c) { // char buf[512]; // sprintf(buf,"got new connection at %.3f",GetTickCount()/1000.0); // OutputDebugString(buf); attachConnection(c,l->port()); } } int x; for (x = 0; x < m_connections->GetSize(); x ++) { WS_conInst *ci = (WS_conInst *)m_connections->Get(x); int rv = run_connection(ci); if (rv<0) { JNL_IConnection *c=ci->m_serv.steal_con(); if (c) { if (c->get_state() == JNL_Connection::STATE_CONNECTED) attachConnection(c,ci->m_port); else delete c; } } if (rv) { delete ci; m_connections->Del(x--); } } }
void WebServerBaseClass::run(void) { int nl; if (m_connections->GetSize() < m_max_con && (nl=m_listeners->GetSize())) { JNL_Listen *l=(JNL_Listen *)m_listeners->Get(m_listener_rot++ % nl); JNL_Connection *c=l->get_connect(); if (c) { attachConnection(c,l->port()); } } int x; for (x = 0; x < m_connections->GetSize(); x ++) { if (run_connection((WS_conInst *)m_connections->Get(x))) { delete ((WS_conInst *)m_connections->Get(x)); m_connections->Del(x--); } } }