changeset 4048:64b7daa6c42c

mod_csi_battery_saver: Ignore CSI actions before resource bind
author tmolitor <thilo@eightysoft.de>
date Mon, 22 Jun 2020 21:35:57 +0200
parents 36b6e3e3f9e2
children 78f1de5301fc
files mod_csi_battery_saver/mod_csi_battery_saver.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_csi_battery_saver/mod_csi_battery_saver.lua	Thu Jun 18 15:24:34 2020 +0200
+++ b/mod_csi_battery_saver/mod_csi_battery_saver.lua	Mon Jun 22 21:35:57 2020 +0200
@@ -150,6 +150,10 @@
 
 module:hook("csi-client-inactive", function (event)
 	local session = event.origin;
+	if not session.resource then
+		session.log("warn", "Ignoring csi if no resource is bound!");
+		return;
+	end
 	if session.pump then
 		session.log("debug", "mod_csi_battery_saver(%s): Client is inactive, buffering unimportant outgoing stanzas", id);
 		session.pump:pause();
@@ -179,6 +183,10 @@
 
 module:hook("csi-client-active", function (event)
 	local session = event.origin;
+	if not session.resource then
+		session.log("warn", "Ignoring csi if no resource is bound!");
+		return;
+	end
 	if session.pump then
 		session.log("debug", "mod_csi_battery_saver(%s): Client is active, resuming direct delivery", id);
 		session.pump:resume();