|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.util.dns.ParallelResolver
public class ParallelResolver
The purpose of this class is to help avoid the significant delays that occur in networks where DNS servers would ignore SRV, NAPTR, and sometimes even A/AAAA queries (i.e. without even sending an error response). We also try to handle cases where DNS servers may return empty responses to some records.
We achieve this by entering a redundant mode whenever we detect an abnormal delay (longer than DNS_PATIENCE) while waiting for a DNS resonse, or when that response is not considered satisfying.
Once we enter redundant mode, we start duplicating all queries and sending them to both our primary and backup resolvers (in case we have any). We then always return the first response we get, regardless of who sent it.
We exit redundant mode after receiving DNS_REDEMPTION consecutive timely and correct responses from our primary resolver.
| Field Summary | |
|---|---|
static int |
currentDnsRedemption
The currently configured number of times that the primary DNS would have to provide a faster response than the backup resolver before we consider it safe enough to exit redundant mode. |
static int |
DNS_PATIENCE
The default number of milliseconds it takes us to get into redundant mode while waiting for a DNS query response. |
static int |
DNS_REDEMPTION
The default number of times that the primary DNS would have to provide a faster response than the backup resolver before we consider it safe enough to exit redundant mode. |
static String |
PNAME_DNS_PATIENCE
The name of the property that allows us to override the default DNS_PATIENCE value. |
static String |
PNAME_DNS_REDEMPTION
The name of the property that allows us to override the default DNS_REDEMPTION value. |
| Constructor Summary | |
|---|---|
ParallelResolver(InetSocketAddress[] backupServers)
Creates a ParallelResolver that would use the specified array of backupServers if the default DNS doesn't seem to be doing that well. |
|
| Method Summary | |
|---|---|
static org.xbill.DNS.Resolver |
getDefaultResolver()
Returns the default resolver used by this class. |
void |
reset()
Resets resolver configuration and populate our default resolver with the newly configured servers. |
org.xbill.DNS.Message |
send(org.xbill.DNS.Message query)
Sends a message and waits for a response. |
Object |
sendAsync(org.xbill.DNS.Message query,
org.xbill.DNS.ResolverListener listener)
Supposed to asynchronously send messages but not currently implemented. |
static void |
setDefaultResolver(org.xbill.DNS.Resolver resolver)
Replaces the default resolver used by this class. |
void |
setEDNS(int level)
Sets the EDNS version used on outgoing messages. |
void |
setEDNS(int level,
int payloadSize,
int flags,
List options)
Sets the EDNS information on outgoing messages. |
void |
setIgnoreTruncation(boolean flag)
Sets whether truncated responses will be ignored. |
void |
setPort(int port)
Sets the port to communicate on with the default servers. |
void |
setTCP(boolean flag)
Sets whether TCP connections will be sent by default with the default resolver. |
void |
setTimeout(int secs)
Sets the amount of time to wait for a response before giving up. |
void |
setTimeout(int secs,
int msecs)
Sets the amount of time to wait for a response before giving up. |
void |
setTSIGKey(org.xbill.DNS.TSIG key)
Specifies the TSIG key that messages will be signed with |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DNS_PATIENCE
public static final String PNAME_DNS_PATIENCE
public static final int DNS_REDEMPTION
public static final String PNAME_DNS_REDEMPTION
public static int currentDnsRedemption
| Constructor Detail |
|---|
public ParallelResolver(InetSocketAddress[] backupServers)
backupServers - the list of backup DNS servers that we should use
if, and only if, the default servers don't seem to work that well.| Method Detail |
|---|
public static void setDefaultResolver(org.xbill.DNS.Resolver resolver)
resolver - the resolver we'd like to use by default from now on.public static org.xbill.DNS.Resolver getDefaultResolver()
public org.xbill.DNS.Message send(org.xbill.DNS.Message query)
throws IOException
send in interface org.xbill.DNS.Resolverquery - The query to send.
IOException - An error occurred while sending or receiving.
public Object sendAsync(org.xbill.DNS.Message query,
org.xbill.DNS.ResolverListener listener)
sendAsync in interface org.xbill.DNS.Resolverquery - The query to sendlistener - The object containing the callbacks.
public void setPort(int port)
setPort in interface org.xbill.DNS.Resolverport - The port to send messages topublic void setTCP(boolean flag)
setTCP in interface org.xbill.DNS.Resolverflag - Indicates whether TCP connections are madepublic void setIgnoreTruncation(boolean flag)
setIgnoreTruncation in interface org.xbill.DNS.Resolverflag - Indicates whether truncated responses should be ignored.public void setEDNS(int level)
setEDNS in interface org.xbill.DNS.Resolverlevel - The EDNS level to use. 0 indicates EDNS0 and -1 indicates no
EDNS.
IllegalArgumentException - An invalid level was indicated.
public void setEDNS(int level,
int payloadSize,
int flags,
List options)
setEDNS in interface org.xbill.DNS.Resolverlevel - The EDNS level to use. 0 indicates EDNS0 and -1 indicates no
EDNS.payloadSize - The maximum DNS packet size that this host is capable
of receiving over UDP. If 0 is specified, the default (1280) is used.flags - EDNS extended flags to be set in the OPT record.options - EDNS options to be set in the OPT record, specified as a
List of OPTRecord.Option elements.
IllegalArgumentException - An invalid field was specified.OPTRecordpublic void setTSIGKey(org.xbill.DNS.TSIG key)
setTSIGKey in interface org.xbill.DNS.Resolverkey - The key
public void setTimeout(int secs,
int msecs)
setTimeout in interface org.xbill.DNS.Resolversecs - The number of seconds to wait.msecs - The number of milliseconds to wait.public void setTimeout(int secs)
setTimeout in interface org.xbill.DNS.Resolversecs - The number of seconds to wait.public void reset()
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||