513 -- Is an outgoing connection |
513 -- Is an outgoing connection |
514 local session = hosts[from].s2sout[to]; |
514 local session = hosts[from].s2sout[to]; |
515 if not session then |
515 if not session then |
516 print("No outgoing connection from "..from.." to "..to) |
516 print("No outgoing connection from "..from.." to "..to) |
517 else |
517 else |
518 s2smanager.destroy_session(session); |
518 (session.close or s2smanager.destroy_session)(session); |
519 count = count + 1; |
519 count = count + 1; |
520 print("Closed outgoing session from "..from.." to "..to); |
520 print("Closed outgoing session from "..from.." to "..to); |
521 end |
521 end |
522 elseif hosts[to] and not hosts[from] then |
522 elseif hosts[to] and not hosts[from] then |
523 -- Is an incoming connection |
523 -- Is an incoming connection |
524 for session in pairs(incoming_s2s) do |
524 for session in pairs(incoming_s2s) do |
525 if session.to_host == to and session.from_host == from then |
525 if session.to_host == to and session.from_host == from then |
526 s2smanager.destroy_session(session); |
526 (session.close or s2smanager.destroy_session)(session); |
527 count = count + 1; |
527 count = count + 1; |
528 end |
528 end |
529 end |
529 end |
530 |
530 |
531 if count == 0 then |
531 if count == 0 then |