Lidgren.Network.NetConnection.CreateReceiverChannel C# (CSharp) Method

CreateReceiverChannel() private method

private CreateReceiverChannel ( NetMessageType tp ) : Lidgren.Network.NetReceiverChannelBase
tp NetMessageType
return Lidgren.Network.NetReceiverChannelBase
        private NetReceiverChannelBase CreateReceiverChannel(NetMessageType tp)
        {
            m_peer.VerifyNetworkThread();

            // create receiver channel
            NetReceiverChannelBase chan;
            NetDeliveryMethod method = NetUtility.GetDeliveryMethod(tp);
            switch (method)
            {
                case NetDeliveryMethod.Unreliable:
                    chan = new NetUnreliableUnorderedReceiver(this);
                    break;
                case NetDeliveryMethod.ReliableOrdered:
                    chan = new NetReliableOrderedReceiver(this, NetConstants.ReliableOrderedWindowSize);
                    break;
                case NetDeliveryMethod.UnreliableSequenced:
                    chan = new NetUnreliableSequencedReceiver(this);
                    break;
                case NetDeliveryMethod.ReliableUnordered:
                    chan = new NetReliableUnorderedReceiver(this, NetConstants.ReliableOrderedWindowSize);
                    break;
                case NetDeliveryMethod.ReliableSequenced:
                    chan = new NetReliableSequencedReceiver(this, NetConstants.ReliableSequencedWindowSize);
                    break;
                default:
                    throw new NetException("Unhandled NetDeliveryMethod!");
            }

            int channelSlot = (int)tp - 1;
            NetException.Assert(m_receiveChannels[channelSlot] == null);
            m_receiveChannels[channelSlot] = chan;

            return chan;
        }