Comparison

plugins/mod_csi_simple.lua @ 9920:4a56d7891bd3

mod_csi_simple: Add some debug logging
author Kim Alvefur <zash@zash.se>
date Sun, 24 Mar 2019 20:53:49 +0100
parent 9919:d602a495409b
child 9921:ec138e4254ed
comparison
equal deleted inserted replaced
9919:d602a495409b 9920:4a56d7891bd3
69 session.csi_counter = ctr + 1; 69 session.csi_counter = ctr + 1;
70 return stanza; 70 return stanza;
71 end 71 end
72 72
73 local function flush_buffer(data, session) 73 local function flush_buffer(data, session)
74 session.log("debug", "Client sent something, flushing buffer once");
74 session.conn:resume_writes(); 75 session.conn:resume_writes();
75 return data; 76 return data;
76 end 77 end
77 78
78 function enable_optimizations(session) 79 function enable_optimizations(session)
107 module:hook("c2s-ondrain", function (event) 108 module:hook("c2s-ondrain", function (event)
108 local session = event.session; 109 local session = event.session;
109 if session.state == "inactive" and session.conn and session.conn and session.conn.pause_writes then 110 if session.state == "inactive" and session.conn and session.conn and session.conn.pause_writes then
110 session.csi_counter = 0; 111 session.csi_counter = 0;
111 session.conn:pause_writes(); 112 session.conn:pause_writes();
113 session.log("debug", "Buffer flushed, resuming inactive mode");
112 end 114 end
113 end); 115 end);
114 116
115 function module.load() 117 function module.load()
116 for _, user_session in pairs(prosody.hosts[module.host].sessions) do 118 for _, user_session in pairs(prosody.hosts[module.host].sessions) do