Esempio n. 1
0
        internal void HandlePackage(Package message, PlayerNetworkSession playerSession)
        {
            Player player = playerSession.Player;

            if (message == null)
            {
                return;
            }

            TraceReceive(message, message.DatagramSequenceNumber);

            if (message.Reliability == Reliability.ReliableOrdered)
            {
                playerSession.AddToProcessing(message);
                return;
            }

            if (typeof(UnknownPackage) == message.GetType())
            {
                UnknownPackage packet = (UnknownPackage)message;
                Log.Warn($"Received unknown package 0x{message.Id:X2}\n{Package.HexDump(packet.Message)}");
                message.PutPool();
                return;
            }

            player?.HandlePackage(message);
            message.PutPool();
        }
Esempio n. 2
0
        internal void HandlePackage(Package message, PlayerNetworkSession playerSession)
        {
            if (message == null)
            {
                return;
            }

            if (message.Reliability == Reliability.ReliableOrdered)
            {
                if (ForceOrderingForAll == false && (playerSession.CryptoContext == null || playerSession.CryptoContext.UseEncryption == false))
                {
                    playerSession.AddToProcessing(message);
                }
                else
                {
                    FastThreadPool.QueueUserWorkItem(() => playerSession.AddToProcessing(message));
                }

                return;
            }

            playerSession.HandlePackage(message, playerSession);
        }