Software /
code /
prosody
Comparison
core/s2smanager.lua @ 4018:5061c8d41d89
s2smanager: retire_session(): Add a 'reason' parameter
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 24 Dec 2010 04:47:18 +0000 |
parent | 4017:2cb5bb26b831 |
child | 4019:80aa47c009f0 |
comparison
equal
deleted
inserted
replaced
4017:2cb5bb26b831 | 4018:5061c8d41d89 |
---|---|
553 session.log("debug", "Attempt to close already-closed session"); | 553 session.log("debug", "Attempt to close already-closed session"); |
554 end; | 554 end; |
555 filter = function (type, data) return data; end; | 555 filter = function (type, data) return data; end; |
556 }; resting_session.__index = resting_session; | 556 }; resting_session.__index = resting_session; |
557 | 557 |
558 function retire_session(session) | 558 function retire_session(session, reason) |
559 local log = session.log or log; | 559 local log = session.log or log; |
560 for k in pairs(session) do | 560 for k in pairs(session) do |
561 if k ~= "trace" and k ~= "log" and k ~= "id" then | 561 if k ~= "trace" and k ~= "log" and k ~= "id" then |
562 session[k] = nil; | 562 session[k] = nil; |
563 end | 563 end |
564 end | 564 end |
565 | |
566 session.destruction_reason = reason; | |
565 | 567 |
566 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); end | 568 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); end |
567 function session.data(data) log("debug", "Discarding data received from resting session: %s", tostring(data)); end | 569 function session.data(data) log("debug", "Discarding data received from resting session: %s", tostring(data)); end |
568 return setmetatable(session, resting_session); | 570 return setmetatable(session, resting_session); |
569 end | 571 end |