core/s2smanager.lua
changeset 4187 1cad1c3495dd
parent 4127 f80b7a92da67
child 4200 fb487ee690ea
equal deleted inserted replaced
4186:6ef3bf4a548e 4187:1cad1c3495dd
   164 		if session.conn ~= conn or
   164 		if session.conn ~= conn or
   165 		   session.type == "s2sin" then
   165 		   session.type == "s2sin" then
   166 			return; -- Ok, we're connect[ed|ing]
   166 			return; -- Ok, we're connect[ed|ing]
   167 		end
   167 		end
   168 		-- Not connected, need to close session and clean up
   168 		-- Not connected, need to close session and clean up
   169 		(session.log or log)("warn", "Destroying incomplete session %s->%s due to inactivity",
   169 		(session.log or log)("debug", "Destroying incomplete session %s->%s due to inactivity",
   170 		    session.from_host or "(unknown)", session.to_host or "(unknown)");
   170 		    session.from_host or "(unknown)", session.to_host or "(unknown)");
   171 		session:close("connection-timeout");
   171 		session:close("connection-timeout");
   172 	end);
   172 	end);
   173 	return session;
   173 	return session;
   174 end
   174 end
   586 	return setmetatable(session, resting_session);
   586 	return setmetatable(session, resting_session);
   587 end
   587 end
   588 
   588 
   589 function destroy_session(session, reason)
   589 function destroy_session(session, reason)
   590 	if session.destroyed then return; end
   590 	if session.destroyed then return; end
   591 	(session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host));
   591 	(session.log or log)("debug", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host));
   592 	
   592 	
   593 	if session.direction == "outgoing" then
   593 	if session.direction == "outgoing" then
   594 		hosts[session.from_host].s2sout[session.to_host] = nil;
   594 		hosts[session.from_host].s2sout[session.to_host] = nil;
   595 		bounce_sendq(session, reason);
   595 		bounce_sendq(session, reason);
   596 	elseif session.direction == "incoming" then
   596 	elseif session.direction == "incoming" then