Exemplo n.º 1
0
        internal RakOfflineHandler(RakConnection connection, IPacketSender sender, GreyListManager greyListManager, MotdProvider motdProvider, ConnectionInfo connectionInfo)
        {
            _sender          = sender;
            _connection      = connection;
            _motdProvider    = motdProvider;
            _connectionInfo  = connectionInfo;
            _greyListManager = greyListManager;

            byte[] buffer = new byte[8];
            new Random().NextBytes(buffer);
            ClientGuid = BitConverter.ToInt64(buffer, 0);
        }
Exemplo n.º 2
0
        public async Task SendTickAsync(RakConnection connection)
        {
            try
            {
                if (_tickCounter++ >= 5)
                {
                    await Task.WhenAll(SendAckQueueAsync(), UpdateAsync(), SendQueueAsync(), connection.UpdateAsync(this));

                    _tickCounter = 0;
                }
                else
                {
                    await Task.WhenAll(SendAckQueueAsync(), SendQueueAsync());
                }
            }
            catch (Exception e)
            {
                Log.Warn(e);
            }
        }