Comparison

util/adminstream.lua @ 12094:84fd6a79cda7

adminstream: fire disconnected event on lower layer disconnect This may in theory cause multiple disconnect events for the adminstream client, if the only code using that wasn't calling os.exit right away. Hence, this should be a good enough partial fix for #1671. It is not a full fix, because the shell will only notice the disconnect after one has hit enter in the input; until then, it is stuck in a read() call to stdin and completely oblivious to the disconnect.
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 21 Dec 2021 21:23:01 +0100
parent 10940:18e4e446a76c
child 12392:5373724e08a5
comparison
equal deleted inserted replaced
12093:b446edb2a51e 12094:84fd6a79cda7
316 end 316 end
317 317
318 function listeners.ondisconnect(conn, err) --luacheck: ignore 212/conn 318 function listeners.ondisconnect(conn, err) --luacheck: ignore 212/conn
319 client.log("info", "Admin client disconnected: %s", err or "connection closed"); 319 client.log("info", "Admin client disconnected: %s", err or "connection closed");
320 client.conn = nil; 320 client.conn = nil;
321 client.events.fire_event("disconnected");
321 end 322 end
322 323
323 function listeners.onreadtimeout(conn) 324 function listeners.onreadtimeout(conn)
324 conn:send(" "); 325 conn:send(" ");
325 end 326 end