// Methods ============================================================================ public void Exec(int next) { ThreadCheck(true); if (dispatcher_delegate_table.Count != 0) { lock (dispatcher_delegate_table) { foreach (var item in dispatcher_delegate_table) { item.Key.Method.Invoke(item.Key.Target, item.Value); } dispatcher_delegate_table.Clear(); } } // ** none if (sess_table.Count == 0) { System.Threading.Thread.Sleep(next); return; } // ** read var subset = from s in sess_table select s.sock; ArrayList list = new ArrayList(subset.ToArray()); Socket.Select(list, null, null, next); foreach (var i in list) { foreach (var item in sess_table) { if (item.sock == i) { if (item.type == SockType.listen) { SockSess retval = SockSess.Accept(item); if (retval == null) { continue; } AddSession(retval); } else { item.Recv(); } break; } } } // ** timeout after read & parse & send & close foreach (SockSess item in sess_table.ToArray()) { if (item.type == SockType.accept && DateTime.Now.Subtract(item.tick).TotalSeconds > stall_time) { item.eof = true; } if (item.RfifoRest() != 0 && sess_parse != null) { sess_parse(this, item); } item.Send(); if (item.eof == true) { if (item.type == SockType.listen) { foreach (var i in FindAcceptSession(item)) { i.eof = true; } } DeleteSession(item); } } }