45 local dns_timeout = config.get("*", "core", "dns_timeout") or 15; |
45 local dns_timeout = config.get("*", "core", "dns_timeout") or 15; |
46 local max_dns_depth = config.get("*", "core", "dns_max_depth") or 3; |
46 local max_dns_depth = config.get("*", "core", "dns_max_depth") or 3; |
47 |
47 |
48 dns.settimeout(dns_timeout); |
48 dns.settimeout(dns_timeout); |
49 |
49 |
|
50 local prosody = _G.prosody; |
50 incoming_s2s = {}; |
51 incoming_s2s = {}; |
51 _G.prosody.incoming_s2s = incoming_s2s; |
52 prosody.incoming_s2s = incoming_s2s; |
52 local incoming_s2s = incoming_s2s; |
53 local incoming_s2s = incoming_s2s; |
53 |
54 |
54 module "s2smanager" |
55 module "s2smanager" |
55 |
56 |
56 function compare_srv_priorities(a,b) |
57 function compare_srv_priorities(a,b) |
514 session.log("info", session.direction.." s2s connection "..from.."->"..to.." complete"); |
515 session.log("info", session.direction.." s2s connection "..from.."->"..to.." complete"); |
515 |
516 |
516 local send_to_host = send_to_host; |
517 local send_to_host = send_to_host; |
517 function session.send(data) send_to_host(to, from, data); end |
518 function session.send(data) send_to_host(to, from, data); end |
518 |
519 |
|
520 local event_data = { session = session }; |
|
521 if session.type == "s2sout" then |
|
522 prosody.events.fire_event("s2sout-established", event_data); |
|
523 hosts[session.from_host].events.fire_event("s2sout-established", event_data); |
|
524 else |
|
525 prosody.events.fire_event("s2sin-established", event_data); |
|
526 hosts[session.to_host].events.fire_event("s2sin-established", event_data); |
|
527 end |
519 |
528 |
520 if session.direction == "outgoing" then |
529 if session.direction == "outgoing" then |
521 if sendq then |
530 if sendq then |
522 session.log("debug", "sending "..#sendq.." queued stanzas across new outgoing connection to "..session.to_host); |
531 session.log("debug", "sending "..#sendq.." queued stanzas across new outgoing connection to "..session.to_host); |
523 for i, data in ipairs(sendq) do |
532 for i, data in ipairs(sendq) do |