summary refs log tree commit diff
path: root/gateway/src/events/Connection.ts
diff options
context:
space:
mode:
Diffstat (limited to 'gateway/src/events/Connection.ts')
-rw-r--r--gateway/src/events/Connection.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/gateway/src/events/Connection.ts b/gateway/src/events/Connection.ts
index fed3c611..1af484eb 100644
--- a/gateway/src/events/Connection.ts
+++ b/gateway/src/events/Connection.ts
@@ -7,6 +7,7 @@ import { Send } from "../util/Send";
 import { CLOSECODES, OPCODES } from "../util/Constants";
 import { createDeflate } from "zlib";
 import { URL } from "url";
+import {Session} from "@fosscord/util";
 var erlpack: any;
 try {
 	erlpack = require("erlpack");
@@ -56,10 +57,12 @@ export async function Connection(this: Server, socket: WebSocket, request: Incom
 		});
 
 		socket.readyTimeout = setTimeout(() => {
+			Session.delete({session_id: socket.session_id}) //should we await?
 			return socket.close(CLOSECODES.Session_timed_out);
 		}, 1000 * 30);
 	} catch (error) {
 		console.error(error);
+		Session.delete({session_id: socket.session_id}) //should we await?
 		return socket.close(CLOSECODES.Unknown_error);
 	}
 }