mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 06:07:37 +03:00
mod_component: Deregister component on disconnect
This commit is contained in:
parent
e7cd3523a4
commit
0ddf0a3232
1 changed files with 4 additions and 3 deletions
|
@ -14,6 +14,7 @@ local t_concat = table.concat;
|
||||||
|
|
||||||
local connlisteners = require "net.connlisteners";
|
local connlisteners = require "net.connlisteners";
|
||||||
local cm_register_component = require "core.componentmanager".register_component;
|
local cm_register_component = require "core.componentmanager".register_component;
|
||||||
|
local cm_deregister_component = require "core.componentmanager".deregister_component;
|
||||||
local uuid_gen = require "util.uuid".generate;
|
local uuid_gen = require "util.uuid".generate;
|
||||||
local sha1 = require "util.hashes".sha1;
|
local sha1 = require "util.hashes".sha1;
|
||||||
local st = stanza;
|
local st = stanza;
|
||||||
|
@ -196,9 +197,9 @@ function component_listener.disconnect(conn, err)
|
||||||
if session then
|
if session then
|
||||||
(session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err));
|
(session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err));
|
||||||
if session.host then
|
if session.host then
|
||||||
if session.component then
|
log("debug", "deregistering component");
|
||||||
deregister_component(session.host);
|
cm_deregister_component(session.host);
|
||||||
end
|
hosts[session.host].connected = nil;
|
||||||
end
|
end
|
||||||
sessions[conn] = nil;
|
sessions[conn] = nil;
|
||||||
session = nil;
|
session = nil;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue