Diff

plugins/mod_c2s.lua @ 12677:3b9771d496ed

mod_smacks: Long overdue cleanup of resumption code, fixes some old TODOs
author Matthew Wild <mwild1@gmail.com>
date Fri, 26 Aug 2022 17:04:15 +0100
parent 12662:07424992d7fc
child 12773:f100c1035576
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Thu Aug 25 22:42:41 2022 +0200
+++ b/plugins/mod_c2s.lua	Fri Aug 26 17:04:15 2022 +0100
@@ -262,6 +262,14 @@
 module:hook_global("user-role-changed", disconnect_user_sessions({ condition = "reset", text = "Role changed" }), 200);
 module:hook_global("user-deleted", disconnect_user_sessions({ condition = "not-authorized", text = "Account deleted" }), 200);
 
+module:hook_global("c2s-session-updated", function (event)
+	sessions[event.session.conn] = event.session;
+	local replaced_conn = event.replaced_conn;
+	if replaced_conn then
+		sessions[replaced_conn] = nil;
+	end
+end);
+
 function runner_callbacks:ready()
 	if self.data.conn then
 		self.data.conn:resume();