Software / code / prosody
Comparison
plugins/mod_component.lua @ 3587:d94aacb2771a
componentmanager, hostmanager, modulemanager, mod_component: Got rid of the useless hosts[*].connected property.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 10 Nov 2010 03:39:38 +0500 |
| parent | 3581:3f3f8227ba76 |
| child | 3604:3e89f0509967 |
comparison
equal
deleted
inserted
replaced
| 3586:78ed7ad330ab | 3587:d94aacb2771a |
|---|---|
| 27 local function on_destroy(session, err) | 27 local function on_destroy(session, err) |
| 28 if main_session == session then | 28 if main_session == session then |
| 29 main_session = nil; | 29 main_session = nil; |
| 30 send = nil; | 30 send = nil; |
| 31 session.on_destroy = nil; | 31 session.on_destroy = nil; |
| 32 hosts[session.host].connected = nil; | |
| 33 end | 32 end |
| 34 end | 33 end |
| 35 | 34 |
| 36 local function handle_stanza(event) | 35 local function handle_stanza(event) |
| 37 local stanza = event.stanza; | 36 local stanza = event.stanza; |
| 96 -- If component not already created for this host, create one now | 95 -- If component not already created for this host, create one now |
| 97 if not main_session then | 96 if not main_session then |
| 98 send = session.send; | 97 send = session.send; |
| 99 main_session = session; | 98 main_session = session; |
| 100 session.on_destroy = on_destroy; | 99 session.on_destroy = on_destroy; |
| 101 hosts[session.host].connected = true; | |
| 102 log("info", "Component successfully registered"); | 100 log("info", "Component successfully registered"); |
| 103 else | 101 else |
| 104 log("error", "Multiple components bound to the same address, first one wins (TODO: Implement stanza distribution)"); | 102 log("error", "Multiple components bound to the same address, first one wins (TODO: Implement stanza distribution)"); |
| 105 session:close{ condition = "conflict", text = "Component already connected" }; | 103 session:close{ condition = "conflict", text = "Component already connected" }; |
| 106 return true; | 104 return true; |