Diff

plugins/mod_csi_simple.lua @ 10277:45a58127a3e5

mod_csi_simple: Remove duplicated check for connection
author Kim Alvefur <zash@zash.se>
date Sat, 28 Sep 2019 22:59:29 +0200 (2019-09-28)
parent 10025:4498f601516d
child 10302:4c53e58d2468
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua	Sat Sep 28 20:00:39 2019 +0200
+++ b/plugins/mod_csi_simple.lua	Sat Sep 28 22:59:29 2019 +0200
@@ -81,7 +81,7 @@
 end
 
 function enable_optimizations(session)
-	if session.conn and session.conn and session.conn.pause_writes then
+	if session.conn and session.conn.pause_writes then
 		session.conn:pause_writes();
 		filters.add_filter(session, "stanzas/out", manage_buffer);
 		filters.add_filter(session, "bytes/in", flush_buffer);
@@ -91,7 +91,7 @@
 end
 
 function disable_optimizations(session)
-	if session.conn and session.conn and session.conn.resume_writes then
+	if session.conn and session.conn.resume_writes then
 		filters.remove_filter(session, "stanzas/out", manage_buffer);
 		filters.remove_filter(session, "bytes/in", flush_buffer);
 		session.conn:resume_writes();
@@ -115,7 +115,7 @@
 
 module:hook("c2s-ondrain", function (event)
 	local session = event.session;
-	if session.state == "inactive" and session.conn and session.conn and session.conn.pause_writes then
+	if session.state == "inactive" and session.conn and session.conn.pause_writes then
 		session.conn:pause_writes();
 		session.log("debug", "Buffer flushed, resuming inactive mode (queue size was %d)", session.csi_counter);
 		session.csi_counter = 0;