void DoDispatch() { lock (((ICollection)_packetlist).SyncRoot) { for (int i = 0; i < _packetlist.Count; i++) { var packet = _packetlist[i]; DispatchMsg(packet); NetPacketPool.DropPacket(packet); } _packetlist.Clear(); } }
void DoSend() { lock (((ICollection)_sendList).SyncRoot) { for (int i = 0; i < _sendList.Count; i++) { var packet = _sendList[i]; syncSend(packet); NetPacketPool.DropPacket(packet); } _sendList.Clear(); } }