//from user thread, our thread, or recv? private void SendPacket(NetPacket packet) { NetUtils.DebugWrite("[RS]Packet: " + packet.Property); switch (packet.Property) { case PacketProperty.ReliableUnordered: _reliableUnorderedChannel.AddToQueue(packet); break; case PacketProperty.Sequenced: _sequencedChannel.AddToQueue(packet); break; case PacketProperty.ReliableOrdered: _reliableOrderedChannel.AddToQueue(packet); break; case PacketProperty.Unreliable: _simpleChannel.AddToQueue(packet); break; case PacketProperty.ReliableSequenced: _reliableSequencedChannel.AddToQueue(packet); break; case PacketProperty.MtuCheck: //Must check result for MTU fix if (!_netManager.SendRawAndRecycle(packet, _remoteEndPoint)) { _finishMtu = true; } break; case PacketProperty.AckReliable: case PacketProperty.AckReliableOrdered: case PacketProperty.Ping: case PacketProperty.Pong: case PacketProperty.MtuOk: SendRawData(packet); _packetPool.Recycle(packet); break; default: throw new InvalidPacketException("Unknown packet property: " + packet.Property); } }
//from user thread, our thread, or recv? private void SendPacket(NetPacket packet) { NetUtils.DebugWrite("[RS]Packet: " + packet.Property); switch (packet.Property) { case PacketProperty.ReliableUnordered: _reliableUnorderedChannel.AddToQueue(packet); break; case PacketProperty.Sequenced: _sequencedChannel.AddToQueue(packet); break; case PacketProperty.ReliableOrdered: _reliableOrderedChannel.AddToQueue(packet); break; case PacketProperty.Unreliable: _simpleChannel.AddToQueue(packet); break; case PacketProperty.ReliableSequenced: _reliableSequencedChannel.AddToQueue(packet); break; case PacketProperty.AckReliable: case PacketProperty.AckReliableOrdered: case PacketProperty.Ping: case PacketProperty.Pong: SendRawData(packet); _packetPool.Recycle(packet); break; default: throw new InvalidPacketException("Unknown packet property: " + packet.Property); } }