time out users due to inactivity
This commit is contained in:
parent
f9fe6e2a27
commit
99a4cd9b67
2 changed files with 11 additions and 1 deletions
|
@ -12,6 +12,7 @@ module.exports = class {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.connectTime = Date.now();
|
this.connectTime = Date.now();
|
||||||
|
this.timeoutTime = Date.now() + 30000;
|
||||||
this.queue = Buffer.alloc(0);
|
this.queue = Buffer.alloc(0);
|
||||||
|
|
||||||
// Binato specific
|
// Binato specific
|
||||||
|
|
|
@ -31,6 +31,12 @@ setInterval(() => {
|
||||||
if (User.id == 3) continue; // Ignore the bot
|
if (User.id == 3) continue; // Ignore the bot
|
||||||
// Bot: :(
|
// Bot: :(
|
||||||
|
|
||||||
|
// Logout this user, they're clearly gone.
|
||||||
|
if (Date.now() >= User.timeoutTime)
|
||||||
|
Logout(User);
|
||||||
|
|
||||||
|
// The user is still here
|
||||||
|
else
|
||||||
User.getNewUserInformationFromDatabase();
|
User.getNewUserInformationFromDatabase();
|
||||||
}
|
}
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
@ -118,6 +124,9 @@ module.exports = async function(req, res) {
|
||||||
|
|
||||||
// Make sure the client's token isn't invalid
|
// Make sure the client's token isn't invalid
|
||||||
if (PacketUser != null) {
|
if (PacketUser != null) {
|
||||||
|
// Update the session timeout time
|
||||||
|
PacketUser.timeoutTime = Date.now() + 60000;
|
||||||
|
|
||||||
// Create a new osu! packet reader
|
// Create a new osu! packet reader
|
||||||
const osuPacketReader = new osu.Client.Reader(requestData);
|
const osuPacketReader = new osu.Client.Reader(requestData);
|
||||||
// Parse current bancho packet
|
// Parse current bancho packet
|
||||||
|
|
Loading…
Reference in a new issue