Comparison

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
comparison
equal deleted inserted replaced
9908:7d12af856238 9909:3229be01a08a
84 return true; 84 return true;
85 end, -1); 85 end, -1);
86 86
87 module:hook("csi-client-inactive", function (event) 87 module:hook("csi-client-inactive", function (event)
88 local session = event.origin; 88 local session = event.origin;
89 if session.pump then 89 if session.conn and session.conn and session.conn.pause_writes then
90 session.conn:pause_writes();
91 elseif session.pump then
90 session.pump:pause(); 92 session.pump:pause();
91 else 93 else
92 local bare_jid = jid.join(session.username, session.host); 94 local bare_jid = jid.join(session.username, session.host);
93 local send = session.send; 95 local send = session.send;
94 session._orig_send = send; 96 session._orig_send = send;
113 115
114 module:hook("csi-client-active", function (event) 116 module:hook("csi-client-active", function (event)
115 local session = event.origin; 117 local session = event.origin;
116 if session.pump then 118 if session.pump then
117 session.pump:resume(); 119 session.pump:resume();
120 elseif session.conn and session.conn and session.conn.resume_writes then
121 session.conn:resume_writes();
118 end 122 end
119 end); 123 end);
120 124