Mercurial > prosody-hg
comparison core/s2smanager.lua @ 1806:c55e06eb53b2
Merge with 0.5
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 21 Sep 2009 14:42:29 +0100 |
| parents | a3b0f21c4e37 7e41ad68fe3c |
| children | f4c88dd32724 |
comparison
equal
deleted
inserted
replaced
| 1803:7fef8649d0f6 | 1806:c55e06eb53b2 |
|---|---|
| 39 | 39 |
| 40 local adns, dns = require "net.adns", require "net.dns"; | 40 local adns, dns = require "net.adns", require "net.dns"; |
| 41 | 41 |
| 42 local connect_timeout = config.get("*", "core", "s2s_timeout") or 60; | 42 local connect_timeout = config.get("*", "core", "s2s_timeout") or 60; |
| 43 local dns_timeout = config.get("*", "core", "dns_timeout") or 60; | 43 local dns_timeout = config.get("*", "core", "dns_timeout") or 60; |
| 44 local max_dns_depth = config.get("*", "core", "dns_max_depth") or 3; | |
| 44 | 45 |
| 45 incoming_s2s = {}; | 46 incoming_s2s = {}; |
| 46 local incoming_s2s = incoming_s2s; | 47 local incoming_s2s = incoming_s2s; |
| 47 | 48 |
| 48 module "s2smanager" | 49 module "s2smanager" |
| 253 handle = nil; | 254 handle = nil; |
| 254 host_session.connecting = nil; | 255 host_session.connecting = nil; |
| 255 | 256 |
| 256 -- COMPAT: This is a compromise for all you CNAME-(ab)users :) | 257 -- COMPAT: This is a compromise for all you CNAME-(ab)users :) |
| 257 if not (reply and reply[1] and reply[1].a) then | 258 if not (reply and reply[1] and reply[1].a) then |
| 259 local count = max_dns_depth; | |
| 258 reply = dns.peek(connect_host, "CNAME", "IN"); | 260 reply = dns.peek(connect_host, "CNAME", "IN"); |
| 259 while reply and reply[1] and not reply[1].a and reply[1].cname do | 261 while count > 0 and reply and reply[1] and not reply[1].a and reply[1].cname do |
| 262 log("debug", "Looking up %s (DNS depth is %d)", tostring(reply[1].cname), count); | |
| 260 reply = dns.peek(reply[1].cname, "A", "IN") or dns.peek(reply[1].cname, "CNAME", "IN"); | 263 reply = dns.peek(reply[1].cname, "A", "IN") or dns.peek(reply[1].cname, "CNAME", "IN"); |
| 264 count = count - 1; | |
| 261 end | 265 end |
| 262 end | 266 end |
| 263 -- end of CNAME resolving | 267 -- end of CNAME resolving |
| 264 | 268 |
| 265 if reply and reply[1] and reply[1].a then | 269 if reply and reply[1] and reply[1].a then |
