Commit 4b987b8c authored by Daniel Wolf's avatar Daniel Wolf

The resolver only has to be created when resolving is active

parent dc9fda67
......@@ -117,7 +117,6 @@ public class DNSTCPProxy extends DNSProxy{
if(parcelFileDescriptor == null)throw new IllegalStateException("The ParcelFileDescriptor passed to DNSTCPProxy is null.");
if(context == null)throw new IllegalStateException("The DNSVPNService passed to DNSTCPProxy is null.");
this.parcelFileDescriptor = parcelFileDescriptor;
resolver = new DNSResolver(context);
this.vpnService = context;
for(IPPortPair pair: upstreamDNSServers){
if(pair != IPPortPair.getEmptyPair() && !pair.getAddress().equals(""))this.upstreamServers.put(pair.getAddress(), pair.getPort());
......@@ -125,6 +124,7 @@ public class DNSTCPProxy extends DNSProxy{
this.resolveLocalRules = resolveLocalRules;
this.queryLogging = queryLogging;
if(queryLogging)queryLogger = new QueryLogger(DatabaseHelper.getInstance(context));
if(resolveLocalRules)resolver = new DNSResolver(context);
this.timeout = timeout;
}
......
......@@ -108,14 +108,14 @@ public class DNSUDPProxy extends DNSProxy{
if(parcelFileDescriptor == null)throw new IllegalStateException("The ParcelFileDescriptor passed to DNSUDPProxy is null.");
if(context == null)throw new IllegalStateException("The DNSVPNService passed to DNSUDPProxy is null.");
this.parcelFileDescriptor = parcelFileDescriptor;
resolver = new DNSResolver(context);
this.vpnService = context;
for(IPPortPair pair: upstreamDNSServers){
if(pair != IPPortPair.getEmptyPair() && !pair.getAddress().equals(""))this.upstreamServers.put(pair.getAddress(), pair.getPort());
}
this.resolveLocalRules = resolveLocalRules;
this.queryLogging = queryLogging;
if(queryLogging)queryLogger = new QueryLogger(DatabaseHelper.getInstance(context));
if(queryLogging) queryLogger = new QueryLogger(DatabaseHelper.getInstance(context));
if(resolveLocalRules) resolver = new DNSResolver(context);
}
@Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment