Comparison

mod_auth_external/mod_auth_external.lua @ 2830:92f6f82397c9

mod_auth_external: Shut down all auth processes when module is unloaded (fixes #674) (thanks ZNikke)
author Kim Alvefur <zash@zash.se>
date Sat, 18 Nov 2017 00:37:42 +0100
parent 2829:8082bfc10e65
child 2834:3fb5f173f213
comparison
equal deleted inserted replaced
2829:8082bfc10e65 2830:92f6f82397c9
40 local ptys = {}; 40 local ptys = {};
41 41
42 local pty_options = { throw_errors = false, no_local_echo = true, use_path = false }; 42 local pty_options = { throw_errors = false, no_local_echo = true, use_path = false };
43 for i = 1, auth_processes do 43 for i = 1, auth_processes do
44 ptys[i] = lpty.new(pty_options); 44 ptys[i] = lpty.new(pty_options);
45 end
46
47 function module.unload()
48 for i = 1, auth_processes do
49 ptys[i]:endproc();
50 end
45 end 51 end
46 52
47 local curr_process = 0; 53 local curr_process = 0;
48 function send_query(text) 54 function send_query(text)
49 curr_process = (curr_process%auth_processes)+1; 55 curr_process = (curr_process%auth_processes)+1;