Diff

plugins/mod_net_multiplex.lua @ 6380:4220ffb87b22

net.http, net.http.server, mod_c2s, mod_s2s, mod_component, mod_admin_telnet, mod_net_multiplex: Add ondetach to release connection from 'sessions' table (or equivalent)
author Matthew Wild <mwild1@gmail.com>
date Fri, 29 Aug 2014 11:54:34 +0100
parent 5120:bcabea740c00
child 7502:021d2b844c51
child 7806:00bca79ae778
line wrap: on
line diff
--- a/plugins/mod_net_multiplex.lua	Fri Aug 29 11:39:56 2014 +0100
+++ b/plugins/mod_net_multiplex.lua	Fri Aug 29 11:54:34 2014 +0100
@@ -34,7 +34,6 @@
 function listener.onincoming(conn, data)
 	if not data then return; end
 	local buf = buffers[conn];
-	buffers[conn] = nil;
 	buf = buf and buf..data or data;
 	for service, multiplex_pattern in pairs(available_services) do
 		if buf:match(multiplex_pattern) then
@@ -57,6 +56,8 @@
 	buffers[conn] = nil; -- warn if no buffer?
 end
 
+listener.ondetach = listener.ondisconnect;
+
 module:provides("net", {
 	name = "multiplex";
 	config_prefix = "";