I have just committed some DNS hacks, so please shout out in case you
see improper behaviour that might be related to DNS resolution (see
r7951 through r7966).
The point of the patch was to make SC work better in certain cases where
NAT boxes/DNS relays silently drop NAPTR and SRV queries without even
sending an error response.
Prior to the patch SC such DNS behaviour would have caused SC to fail or
take incredibly long while logging into XMPP and SIP accounts.
With the new patch, SC would try to detect when a DNS server is taking
longer than normal to respond to a query. Currently our tollerance is of
1500ms. Once this happens SC would start duplicating all DNS queries to
both the default DNS and a backup resolver that we preconfigure (i.e. a
public name server such as OpenDNS or Google). We call this "redundant mode"
While in redundant mode, SC would always take the first DNS response
that comes to either of its duplicated queries.
SC would exit redundant mode if it sees that the primary DNS starts
providing prompt responses again (i.e. faster than those of the backup
resolver). It currently takes three consecutive DNS queries with a
prompt response from the primary server for SC to go back to normal.
The main goal of the patch was not to modify default resolution
procedures but to rather complete them. In that respect, the backup DNS
servers would never substitute the primary one for example. We simply
start asking a second DNS.
So that's about it.
Comments are most welcome especially if you see an issue with either the
above scheme or the code that implements it.