Software /
code /
prosody
Comparison
plugins/mod_c2s.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 | 6364:4e93e8768c36 |
child | 6382:57d23c26039b |
child | 7100:301d58705667 |
comparison
equal
deleted
inserted
replaced
6379:a280bd6ccce2 | 6380:4220ffb87b22 |
---|---|
264 | 264 |
265 function listener.associate_session(conn, session) | 265 function listener.associate_session(conn, session) |
266 sessions[conn] = session; | 266 sessions[conn] = session; |
267 end | 267 end |
268 | 268 |
269 function listener.ondetach(conn) | |
270 sessions[conn] = nil; | |
271 end | |
272 | |
269 module:hook("server-stopping", function(event) | 273 module:hook("server-stopping", function(event) |
270 local reason = event.reason; | 274 local reason = event.reason; |
271 for _, session in pairs(sessions) do | 275 for _, session in pairs(sessions) do |
272 session:close{ condition = "system-shutdown", text = reason }; | 276 session:close{ condition = "system-shutdown", text = reason }; |
273 end | 277 end |