core/s2smanager.lua
changeset 4993 5243b74a4cbb
parent 4930 42ac50c0382e
child 4994 d4e6a07a7c33
equal deleted inserted replaced
4992:e79e4d1f75de 4993:5243b74a4cbb
    85 function mark_connected(session)
    85 function mark_connected(session)
    86 	local sendq, send = session.sendq, session.sends2s;
    86 	local sendq, send = session.sendq, session.sends2s;
    87 	
    87 	
    88 	local from, to = session.from_host, session.to_host;
    88 	local from, to = session.from_host, session.to_host;
    89 	
    89 	
    90 	session.log("info", session.direction.." s2s connection "..from.."->"..to.." complete");
    90 	session.log("info", "%s s2s connection %s->%s complete", session.direction, from, to);
    91 
    91 
    92 	local event_data = { session = session };
    92 	local event_data = { session = session };
    93 	if session.type == "s2sout" then
    93 	if session.type == "s2sout" then
    94 		prosody.events.fire_event("s2sout-established", event_data);
    94 		prosody.events.fire_event("s2sout-established", event_data);
    95 		hosts[from].events.fire_event("s2sout-established", event_data);
    95 		hosts[from].events.fire_event("s2sout-established", event_data);
   103 		hosts[to].events.fire_event("s2sin-established", event_data);
   103 		hosts[to].events.fire_event("s2sin-established", event_data);
   104 	end
   104 	end
   105 	
   105 	
   106 	if session.direction == "outgoing" then
   106 	if session.direction == "outgoing" then
   107 		if sendq then
   107 		if sendq then
   108 			session.log("debug", "sending "..#sendq.." queued stanzas across new outgoing connection to "..session.to_host);
   108 			session.log("debug", "sending %d queued stanzas across new outgoing connection to %s", #sendq, session.to_host);
   109 			for i, data in ipairs(sendq) do
   109 			for i, data in ipairs(sendq) do
   110 				send(data[1]);
   110 				send(data[1]);
   111 				sendq[i] = nil;
   111 				sendq[i] = nil;
   112 			end
   112 			end
   113 			session.sendq = nil;
   113 			session.sendq = nil;