mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
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)
This commit is contained in:
parent
257d0f104b
commit
899b6d53ae
7 changed files with 26 additions and 1 deletions
|
@ -72,6 +72,10 @@ function listener.ondisconnect(conn, err)
|
|||
requests[conn] = nil;
|
||||
end
|
||||
|
||||
function listener.ondetach(conn)
|
||||
requests[conn] = nil;
|
||||
end
|
||||
|
||||
local function request_reader(request, data, err)
|
||||
if not request.parser then
|
||||
local function error_cb(reason)
|
||||
|
|
|
@ -142,6 +142,10 @@ function listener.ondisconnect(conn)
|
|||
sessions[conn] = nil;
|
||||
end
|
||||
|
||||
function listener.ondetach(conn)
|
||||
sessions[conn] = nil;
|
||||
end
|
||||
|
||||
function listener.onincoming(conn, data)
|
||||
sessions[conn]:feed(data);
|
||||
end
|
||||
|
|
|
@ -163,6 +163,10 @@ function console_listener.ondisconnect(conn, err)
|
|||
end
|
||||
end
|
||||
|
||||
function console_listener.ondetach(conn)
|
||||
sessions[conn] = nil;
|
||||
end
|
||||
|
||||
-- Console commands --
|
||||
-- These are simple commands, not valid standalone in Lua
|
||||
|
||||
|
|
|
@ -266,6 +266,10 @@ function listener.associate_session(conn, session)
|
|||
sessions[conn] = session;
|
||||
end
|
||||
|
||||
function listener.ondetach(conn)
|
||||
sessions[conn] = nil;
|
||||
end
|
||||
|
||||
module:hook("server-stopping", function(event)
|
||||
local reason = event.reason;
|
||||
for _, session in pairs(sessions) do
|
||||
|
|
|
@ -319,6 +319,10 @@ function listener.ondisconnect(conn, err)
|
|||
end
|
||||
end
|
||||
|
||||
function listener.ondetach(conn)
|
||||
sessions[conn] = nil;
|
||||
end
|
||||
|
||||
module:provides("net", {
|
||||
name = "component";
|
||||
private = true;
|
||||
|
|
|
@ -34,7 +34,6 @@ end
|
|||
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 @@ function listener.ondisconnect(conn, err)
|
|||
buffers[conn] = nil; -- warn if no buffer?
|
||||
end
|
||||
|
||||
listener.ondetach = listener.ondisconnect;
|
||||
|
||||
module:provides("net", {
|
||||
name = "multiplex";
|
||||
config_prefix = "";
|
||||
|
|
|
@ -638,6 +638,10 @@ function listener.register_outgoing(conn, session)
|
|||
initialize_session(session);
|
||||
end
|
||||
|
||||
function listener.ondetach(conn)
|
||||
sessions[conn] = nil;
|
||||
end
|
||||
|
||||
function check_auth_policy(event)
|
||||
local host, session = event.host, event.session;
|
||||
local must_secure = secure_auth;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue