OpenMetaverse.PacketEventDictionary.BeginRaiseEvent C# (CSharp) Method

BeginRaiseEvent() private method

Fire the events registered for this packet type asynchronously
private BeginRaiseEvent ( PacketType packetType, Packet packet, Simulator simulator ) : void
packetType PacketType Incoming packet type
packet OpenMetaverse.Packets.Packet Incoming packet
simulator Simulator Simulator this packet was received from
return void
        internal void BeginRaiseEvent(PacketType packetType, Packet packet, Simulator simulator)
        {
            NetworkManager.PacketCallback callback;
            PacketCallbackWrapper wrapper;

            // Default handler first, if one exists
            if (_EventTable.TryGetValue(PacketType.Default, out callback))
            {
                if (callback != null)
                {
                    wrapper.Callback = callback;
                    wrapper.Packet = packet;
                    wrapper.Simulator = simulator;
                    ThreadPool.QueueUserWorkItem(_ThreadPoolCallback, wrapper);
                }
            }

            if (_EventTable.TryGetValue(packetType, out callback))
            {
                if (callback != null)
                {
                    wrapper.Callback = callback;
                    wrapper.Packet = packet;
                    wrapper.Simulator = simulator;
                    ThreadPool.QueueUserWorkItem(_ThreadPoolCallback, wrapper);

                    return;
                }
            }

            if (packetType != PacketType.Default && packetType != PacketType.PacketAck)
            {
                Logger.DebugLog("No handler registered for packet event " + packetType, Client);
            }
        }