Software /
code /
prosody-modules
Changeset
1367:103d685e2153
mod_s2s_auth_dane: Pause s2sin while doing SRV and TLSA lookups, fixes race condition (Can haz util.async plz)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Mar 2014 15:31:15 +0100 |
parents | 1366:f581210093a7 |
children | 1368:5724008bbdb1 |
files | mod_s2s_auth_dane/mod_s2s_auth_dane.lua |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;