예제 #1
0
        public void Update()
        {
            if (_initialized)
            {
                uint currentTimestamp = GameTime.GetGameTimeMS();
                uint diff             = currentTimestamp - _previousTimestamp;
                _previousTimestamp = currentTimestamp;

                if (_dataSent)
                {
                    uint maxClientResponseDelay = WorldConfig.GetUIntValue(WorldCfg.WardenClientResponseDelay);
                    if (maxClientResponseDelay > 0)
                    {
                        // Kick player if client response delays more than set in config
                        if (_clientResponseTimer > maxClientResponseDelay * Time.InMilliseconds)
                        {
                            Log.outWarn(LogFilter.Warden, "{0} (latency: {1}, IP: {2}) exceeded Warden module response delay for more than {3} - disconnecting client",
                                        _session.GetPlayerInfo(), _session.GetLatency(), _session.GetRemoteAddress(), Time.secsToTimeString(maxClientResponseDelay, true));
                            _session.KickPlayer();
                        }
                        else
                        {
                            _clientResponseTimer += diff;
                        }
                    }
                }
                else
                {
                    if (diff >= _checkTimer)
                    {
                        RequestData();
                    }
                    else
                    {
                        _checkTimer -= diff;
                    }
                }
            }
        }