Commit e2a83e51 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

The workaround has to be performed on versions below lollipop, not every version exception

parent f1d0ae56
...@@ -183,8 +183,6 @@ public class DNSTCPProxy extends DNSProxy{ ...@@ -183,8 +183,6 @@ public class DNSTCPProxy extends DNSProxy{
private int pollTries = 0; private int pollTries = 0;
private void poll(StructPollfd[] polls, int timeout) throws ErrnoException { private void poll(StructPollfd[] polls, int timeout) throws ErrnoException {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.M){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.M){
Os.poll(polls, timeout);
}else {
pollTries++; pollTries++;
try{ try{
Os.poll(polls, timeout/pollTries); Os.poll(polls, timeout/pollTries);
...@@ -193,6 +191,8 @@ public class DNSTCPProxy extends DNSProxy{ ...@@ -193,6 +191,8 @@ public class DNSTCPProxy extends DNSProxy{
if(pollTries < 3) poll(polls, timeout); if(pollTries < 3) poll(polls, timeout);
else throw ex; else throw ex;
} }
}else {
Os.poll(polls, timeout);
} }
} }
......
...@@ -174,8 +174,6 @@ public class DNSUDPProxy extends DNSProxy{ ...@@ -174,8 +174,6 @@ public class DNSUDPProxy extends DNSProxy{
private int pollTries = 0; private int pollTries = 0;
private void poll(StructPollfd[] polls, int timeout) throws ErrnoException { private void poll(StructPollfd[] polls, int timeout) throws ErrnoException {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.M){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.M){
Os.poll(polls, timeout);
}else {
pollTries++; pollTries++;
try{ try{
Os.poll(polls, timeout/pollTries); Os.poll(polls, timeout/pollTries);
...@@ -184,6 +182,8 @@ public class DNSUDPProxy extends DNSProxy{ ...@@ -184,6 +182,8 @@ public class DNSUDPProxy extends DNSProxy{
if(pollTries < 3) poll(polls, timeout); if(pollTries < 3) poll(polls, timeout);
else throw ex; else throw ex;
} }
}else {
Os.poll(polls, timeout);
} }
} }
......
Supports Markdown
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