Software /
code /
prosody
Comparison
core/s2smanager.lua @ 5776:bd0ff8ae98a8
Remove all trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 09 Aug 2013 17:48:21 +0200 |
parent | 5459:3a821511b9ec |
child | 6663:d3023dd07cb6 |
comparison
equal
deleted
inserted
replaced
5775:a6c2b8933507 | 5776:bd0ff8ae98a8 |
---|---|
1 -- Prosody IM | 1 -- Prosody IM |
2 -- Copyright (C) 2008-2010 Matthew Wild | 2 -- Copyright (C) 2008-2010 Matthew Wild |
3 -- Copyright (C) 2008-2010 Waqas Hussain | 3 -- Copyright (C) 2008-2010 Waqas Hussain |
4 -- | 4 -- |
5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 | 8 |
9 | 9 |
68 end | 68 end |
69 | 69 |
70 function destroy_session(session, reason) | 70 function destroy_session(session, reason) |
71 if session.destroyed then return; end | 71 if session.destroyed then return; end |
72 (session.log or log)("debug", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host)..(reason and (": "..reason) or "")); | 72 (session.log or log)("debug", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host)..(reason and (": "..reason) or "")); |
73 | 73 |
74 if session.direction == "outgoing" then | 74 if session.direction == "outgoing" then |
75 hosts[session.from_host].s2sout[session.to_host] = nil; | 75 hosts[session.from_host].s2sout[session.to_host] = nil; |
76 session:bounce_sendq(reason); | 76 session:bounce_sendq(reason); |
77 elseif session.direction == "incoming" then | 77 elseif session.direction == "incoming" then |
78 incoming_s2s[session] = nil; | 78 incoming_s2s[session] = nil; |
79 end | 79 end |
80 | 80 |
81 local event_data = { session = session, reason = reason }; | 81 local event_data = { session = session, reason = reason }; |
82 if session.type == "s2sout" then | 82 if session.type == "s2sout" then |
83 fire_event("s2sout-destroyed", event_data); | 83 fire_event("s2sout-destroyed", event_data); |
84 if hosts[session.from_host] then | 84 if hosts[session.from_host] then |
85 hosts[session.from_host].events.fire_event("s2sout-destroyed", event_data); | 85 hosts[session.from_host].events.fire_event("s2sout-destroyed", event_data); |
88 fire_event("s2sin-destroyed", event_data); | 88 fire_event("s2sin-destroyed", event_data); |
89 if hosts[session.to_host] then | 89 if hosts[session.to_host] then |
90 hosts[session.to_host].events.fire_event("s2sin-destroyed", event_data); | 90 hosts[session.to_host].events.fire_event("s2sin-destroyed", event_data); |
91 end | 91 end |
92 end | 92 end |
93 | 93 |
94 retire_session(session, reason); -- Clean session until it is GC'd | 94 retire_session(session, reason); -- Clean session until it is GC'd |
95 return true; | 95 return true; |
96 end | 96 end |
97 | 97 |
98 return _M; | 98 return _M; |