Exemplo n.º 1
0
        private void ThreadPoolDelegate(Object state)
        {
            PacketCallbackWrapper wrapper = (PacketCallbackWrapper)state;

            try
            {
                wrapper.Callback(this, new PacketReceivedEventArgs(wrapper.Packet, wrapper.Simulator));
            }
            catch (Exception ex)
            {
                Logger.Log("Async Packet Event Handler: " + ex.ToString(), Helpers.LogLevel.Error, Client);
            }
        }
Exemplo n.º 2
0
        private void ThreadPoolDelegate(Object state)
        {
            PacketCallbackWrapper wrapper = (PacketCallbackWrapper)state;

            try
            {
                wrapper.Callback(wrapper.Packet, wrapper.Agent);
            }
            catch (Exception ex)
            {
                Logger.Log("Async Packet Event Handler: " + ex.ToString(), Helpers.LogLevel.Error);
            }
        }
Exemplo n.º 3
0
        private void PacketDelegate(object state)
        {
            PacketCallbackWrapper wrapper        = (PacketCallbackWrapper)state;
            IncomingPacket        incomingPacket = wrapper.IncomingPacket;
            LLAgent agent = wrapper.IncomingPacket.Agent;

            if (!agent.IsConnected)
            {
                m_log.DebugFormat("Dropping incoming {0} packet (#{1}) for dead client {2}",
                                  incomingPacket.Packet.Type, incomingPacket.Packet.Header.ID, agent.ID);
                return;
            }

            try
            {
                wrapper.Callback(incomingPacket.Packet, agent);
            }
            catch (Exception ex)
            {
                m_log.Error("Async Packet Event Handler: " + ex.Message, ex);
            }

            // TODO: Optionally log timing info for this packet
            int now = Util.TickCount();

            int recvTime = incomingPacket.StartedHandling - incomingPacket.Received;

            if (recvTime > 1000)
            {
                m_log.Warn("Spent " + recvTime + "ms receiving " + incomingPacket.Packet.Type +
                           " packet for " + wrapper.IncomingPacket.Agent);
            }

            int processTime = now - incomingPacket.StartedHandling;

            if (processTime > 1000)
            {
                m_log.Warn("Spent " + processTime + "ms processing " + incomingPacket.Packet.Type +
                           " packet for " + incomingPacket.Agent);
            }
        }