Software /
code /
prosody
Comparison
core/s2smanager.lua @ 3950:27947d66b814
s2smanager: retire_session(): Add a 'reason' parameter
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 24 Dec 2010 04:47:18 +0000 |
parent | 3948:d0b8fa486458 |
child | 3951:b8d930c21a3a |
comparison
equal
deleted
inserted
replaced
3949:fc4ff6db1e57 | 3950:27947d66b814 |
---|---|
590 session.log("debug", "Attempt to close already-closed session"); | 590 session.log("debug", "Attempt to close already-closed session"); |
591 end; | 591 end; |
592 filter = function (type, data) return data; end; | 592 filter = function (type, data) return data; end; |
593 }; resting_session.__index = resting_session; | 593 }; resting_session.__index = resting_session; |
594 | 594 |
595 function retire_session(session) | 595 function retire_session(session, reason) |
596 local log = session.log or log; | 596 local log = session.log or log; |
597 for k in pairs(session) do | 597 for k in pairs(session) do |
598 if k ~= "trace" and k ~= "log" and k ~= "id" then | 598 if k ~= "trace" and k ~= "log" and k ~= "id" then |
599 session[k] = nil; | 599 session[k] = nil; |
600 end | 600 end |
601 end | 601 end |
602 | |
603 session.destruction_reason = reason; | |
602 | 604 |
603 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); end | 605 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); end |
604 function session.data(data) log("debug", "Discarding data received from resting session: %s", tostring(data)); end | 606 function session.data(data) log("debug", "Discarding data received from resting session: %s", tostring(data)); end |
605 return setmetatable(session, resting_session); | 607 return setmetatable(session, resting_session); |
606 end | 608 end |