Comparison

plugins/mod_c2s.lua @ 13384:57ad1dfd8e8b

mod_c2s: Make c2s_timeout timer reachable to allow access from other modules E.g. the timeout could be extended under certain conditions.
author Kim Alvefur <zash@zash.se>
date Sun, 03 Dec 2023 15:46:33 +0100
parent 13289:38c95544b7ee
child 13420:7dc7e2e15b2a
comparison
equal deleted inserted replaced
13383:091667bd2f0e 13384:57ad1dfd8e8b
367 end 367 end
368 end 368 end
369 end 369 end
370 370
371 if c2s_timeout < math.huge then 371 if c2s_timeout < math.huge then
372 add_task(c2s_timeout, function () 372 session.c2s_timeout = add_task(c2s_timeout, function ()
373 if session.type == "c2s_unauthed" then 373 if session.type == "c2s_unauthed" then
374 (session.log or log)("debug", "Connection still not authenticated after c2s_timeout=%gs, closing it", c2s_timeout); 374 (session.log or log)("debug", "Connection still not authenticated after c2s_timeout=%gs, closing it", c2s_timeout);
375 session:close("connection-timeout"); 375 session:close("connection-timeout");
376 else
377 session.c2s_timeout = nil;
376 end 378 end
377 end); 379 end);
378 end 380 end
379 381
380 session.dispatch_stanza = stream_callbacks.handlestanza; 382 session.dispatch_stanza = stream_callbacks.handlestanza;