示例#1
0
        public void Process(Connection connection)
        {
            Connection = connection;

            using (Reader = new BinaryReader(new MemoryStream(connection.Buffer)))
            {
                Read();
            }

            try
            {
                Process();
            }
            catch (Exception ex)
            {
                Log.WarnException("ARecvPacket", ex);
            }
        }
示例#2
0
        public static void ValidateAuthToken(Connection con, string token)
        {
            if (con.Account != null)
            {
                con.CloseConnection(true);
                return;
            }
            AccountData account = GetAccountDataByToken(token);
            if (account == null)
            {
                Log.Info("Invalid token from client: {0}", con.Client.RemoteEndPoint.ToString());
                con.CloseConnection(true);
                return;
            }
            int time = Funcs.GetRoundedUtc();
            if ((time - account.LoginToken.TokenCreationTime) > 10 * 60)
            {
                Log.Info("Token '{0}' time expired from client: {1}", token, con.Client.RemoteEndPoint.ToString());
                con.CloseConnection(true);
                return;
            }
            new SpLogIn(_gameHashes[account.Id]).Send(con);//Sending individual hashes

            _tokens.Remove(account.LoginToken.Key);//Remove Auth Token

            account.LoginToken = null;
            con.Account = account;
        }