# HG changeset patch # User Kim Alvefur # Date 1395325875 -3600 # Node ID 103d685e2153e411109b60066ed5cf5cf33bcd50 # Parent f581210093a739e3a58b24cb32ea228517c86a97 mod_s2s_auth_dane: Pause s2sin while doing SRV and TLSA lookups, fixes race condition (Can haz util.async plz) diff -r f581210093a7 -r 103d685e2153 mod_s2s_auth_dane/mod_s2s_auth_dane.lua --- a/mod_s2s_auth_dane/mod_s2s_auth_dane.lua Wed Mar 19 23:17:55 2014 +0100 +++ b/mod_s2s_auth_dane/mod_s2s_auth_dane.lua Thu Mar 20 15:31:15 2014 +0100 @@ -108,8 +108,17 @@ function module.add_host(module) module:hook("s2s-stream-features", function(event) -- dane_lookup(origin, origin.from_host); - dane_lookup(event.origin); - end, 1); + local host_session = event.origin; + host_session.log("debug", "Pausing connection until DANE lookup is completed"); + host_session.conn:pause() + local function resume() + module:log("eebug", "Resuming connection"); + host_session.conn:resume() + end + if not dane_lookup(host_session, resume) then + resume(); + end + end, 10); module:hook("s2s-authenticated", function(event) local session = event.session;