private void PushInternalMsg(Packet.enInternalMsgType type) { com.QH.QPGame.GameUtils.Logger.Net.Log("PushInternalMsg:" + type.ToString()); var packet = NetPacketPool.PopPacket(Packet.enPacketType.Internal); packet.MainCmd = (uint)type; lock (((ICollection)_packetlist).SyncRoot) { _packetlist.Add(packet); } }
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(); } }
public virtual void SendData(UInt32 mainCmd, UInt32 subCmd, int handleCode, byte[] dataBuffer) { if (clientSocket == null || clientSocket.Connected == false) { return; } var packet = NetPacketPool.PopPacket(Packet.enPacketType.Network); packet.MainCmd = mainCmd; packet.SubCmd = subCmd; packet.CheckCode = handleCode; packet.Data = dataBuffer; _sendList.Add(packet); }