Diff

mod_s2s_auth_dane/mod_s2s_auth_dane.lua @ 1435:cdc8f226a284

mod_s2s_auth_dane: Pause connection only if needed
author Kim Alvefur <zash@zash.se>
date Thu, 12 Jun 2014 12:31:50 +0200
parent 1434:1caf971a2f0f
child 1436:3944e364ba88
line wrap: on
line diff
--- a/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Thu Jun 12 12:30:39 2014 +0200
+++ b/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Thu Jun 12 12:31:50 2014 +0200
@@ -112,14 +112,13 @@
 	local function on_new_s2s(event)
 		local host_session = event.origin;
 		if host_session.type == "s2sout" or host_session.type == "s2sin" or host_session.dane ~= nil then return end -- Already authenticated
-		host_session.log("debug", "Pausing connection until DANE lookup is completed");
-		host_session.conn:pause()
 		local function resume()
 			host_session.log("debug", "DANE lookup completed, resuming connection");
 			host_session.conn:resume()
 		end
-		if not dane_lookup(host_session, resume) then
-			resume();
+		if dane_lookup(host_session, resume) then
+			host_session.log("debug", "Pausing connection until DANE lookup is completed");
+			host_session.conn:pause()
 		end
 	end