From ca834b758f4a665f9f7a8f5a762d8ce102a9782a Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 4 Nov 2018 19:03:42 +0000 Subject: [PATCH] Disconnect logic a bit --- webapp/titanembeds/blueprints/gateway/gateway.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/titanembeds/blueprints/gateway/gateway.py b/webapp/titanembeds/blueprints/gateway/gateway.py index d05f49c..5df5ef6 100644 --- a/webapp/titanembeds/blueprints/gateway/gateway.py +++ b/webapp/titanembeds/blueprints/gateway/gateway.py @@ -47,7 +47,7 @@ class Gateway(Namespace): def on_disconnect(self): if "user_keys" not in session: - return + disconnect() if "socket_guild_id" not in session: disconnect() else: @@ -75,6 +75,8 @@ class Gateway(Namespace): self.teardown_db_session() def on_heartbeat(self, data): + if "socket_guild_id" not in session: + disconnect() guild_id = data["guild_id"] visitor_mode = data["visitor_mode"] if not visitor_mode: @@ -99,6 +101,8 @@ class Gateway(Namespace): self.teardown_db_session() def on_channel_list(self, data): + if "socket_guild_id" not in session: + disconnect() guild_id = data["guild_id"] visitor_mode = data["visitor_mode"] channels = None @@ -116,6 +120,8 @@ class Gateway(Namespace): self.teardown_db_session() def on_current_user_info(self, data): + if "socket_guild_id" not in session: + disconnect() guild_id = data["guild_id"] if "user_keys" in session and not session["unauthenticated"]: dbMember = get_guild_member(guild_id, session["user_id"]) @@ -158,6 +164,8 @@ class Gateway(Namespace): return color def on_lookup_user_info(self, data): + if "socket_guild_id" not in session: + disconnect() guild_id = data["guild_id"] name = data["name"] discriminator = data["discriminator"]