Software / code / prosody
Comparison
plugins/mod_console.lua @ 1821:05ed826da89b
mod_console: s2s:close: Use session:close() if that exists, otherwise just destroy the session
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 24 Sep 2009 23:44:13 +0100 |
| parent | 1798:4c8f3fa9d926 |
| child | 1823:7c3ec7ac6316 |
| child | 1906:88c61368e669 |
comparison
equal
deleted
inserted
replaced
| 1820:3e0e9f80010a | 1821:05ed826da89b |
|---|---|
| 494 -- Is an outgoing connection | 494 -- Is an outgoing connection |
| 495 local session = hosts[from].s2sout[to]; | 495 local session = hosts[from].s2sout[to]; |
| 496 if not session then | 496 if not session then |
| 497 print("No outgoing connection from "..from.." to "..to) | 497 print("No outgoing connection from "..from.." to "..to) |
| 498 else | 498 else |
| 499 s2smanager.destroy_session(session); | 499 (session.close or s2smanager.destroy_session)(session); |
| 500 count = count + 1; | 500 count = count + 1; |
| 501 print("Closed outgoing session from "..from.." to "..to); | 501 print("Closed outgoing session from "..from.." to "..to); |
| 502 end | 502 end |
| 503 elseif hosts[to] and not hosts[from] then | 503 elseif hosts[to] and not hosts[from] then |
| 504 -- Is an incoming connection | 504 -- Is an incoming connection |
| 505 for session in pairs(incoming_s2s) do | 505 for session in pairs(incoming_s2s) do |
| 506 if session.to_host == to and session.from_host == from then | 506 if session.to_host == to and session.from_host == from then |
| 507 s2smanager.destroy_session(session); | 507 (session.close or s2smanager.destroy_session)(session); |
| 508 count = count + 1; | 508 count = count + 1; |
| 509 end | 509 end |
| 510 end | 510 end |
| 511 | 511 |
| 512 if count == 0 then | 512 if count == 0 then |