static void ReadPackets() { for (int i = 0; i < usrList.Count; i++) { User u = usrList[i]; InputPacket ip = u.readPacket(); while (ip != null) { switch (ip.getProtocol()) { case Protocol.REQUEST_CHANGE_DESTINATION: handleRequestChangeDestination(ip, u); break; } ip = u.readPacket(); } } }
static void SweepTmpList() { lock (tempList) { for (int i = 0; i < tempList.Count; i++) { User u = tempList[i]; InputPacket ip = u.readPacket(); if (ip != null) { if (ip.getProtocol() == Protocol.REQUEST_ENTER) { handleRequestEnter(ip, u); } else { u.close(); } tempList.RemoveAt(i); i--; } } } }