Diff

plugins/mod_csi_simple.lua @ 9909:3229be01a08a

mod_csi_simple: Use write locks in net.server if available
author Kim Alvefur <zash@zash.se>
date Sat, 24 Nov 2018 02:25:44 +0100
parent 9771:bf92f37de137
child 9911:ed011935c22d
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua	Sun Mar 24 08:18:19 2019 +0000
+++ b/plugins/mod_csi_simple.lua	Sat Nov 24 02:25:44 2018 +0100
@@ -86,7 +86,9 @@
 
 module:hook("csi-client-inactive", function (event)
 	local session = event.origin;
-	if session.pump then
+	if session.conn and session.conn and session.conn.pause_writes then
+		session.conn:pause_writes();
+	elseif session.pump then
 		session.pump:pause();
 	else
 		local bare_jid = jid.join(session.username, session.host);
@@ -115,6 +117,8 @@
 	local session = event.origin;
 	if session.pump then
 		session.pump:resume();
+	elseif session.conn and session.conn and session.conn.resume_writes then
+		session.conn:resume_writes();
 	end
 end);