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

Use a timeout for the poll

parent 8a9f939e
...@@ -157,7 +157,7 @@ public class DNSTCPProxy extends DNSProxy{ ...@@ -157,7 +157,7 @@ public class DNSTCPProxy extends DNSProxy{
pollingFd.fd = ParcelFileDescriptor.fromSocket(socket).getFileDescriptor(); pollingFd.fd = ParcelFileDescriptor.fromSocket(socket).getFileDescriptor();
pollingFd.events = (short)OsConstants.POLLIN; pollingFd.events = (short)OsConstants.POLLIN;
} }
poll(polls, -1); poll(polls, 3000);
} }
if(blockFd.revents != 0){ if(blockFd.revents != 0){
shouldRun = false; shouldRun = false;
...@@ -187,7 +187,7 @@ public class DNSTCPProxy extends DNSProxy{ ...@@ -187,7 +187,7 @@ public class DNSTCPProxy extends DNSProxy{
}else { }else {
pollTries++; pollTries++;
try{ try{
Os.poll(polls, timeout); Os.poll(polls, timeout/pollTries);
pollTries = 0; pollTries = 0;
} catch(ErrnoException ex){ } catch(ErrnoException ex){
if(pollTries < 3) poll(polls, timeout); if(pollTries < 3) poll(polls, timeout);
......
...@@ -148,7 +148,7 @@ public class DNSUDPProxy extends DNSProxy{ ...@@ -148,7 +148,7 @@ public class DNSUDPProxy extends DNSProxy{
pollingFd.fd = ParcelFileDescriptor.fromDatagramSocket(socket).getFileDescriptor(); pollingFd.fd = ParcelFileDescriptor.fromDatagramSocket(socket).getFileDescriptor();
pollingFd.events = (short)OsConstants.POLLIN; pollingFd.events = (short)OsConstants.POLLIN;
} }
poll(polls, -1); poll(polls, 3000);
} }
if(blockFd.revents != 0){ if(blockFd.revents != 0){
shouldRun = false; shouldRun = false;
...@@ -178,7 +178,7 @@ public class DNSUDPProxy extends DNSProxy{ ...@@ -178,7 +178,7 @@ public class DNSUDPProxy extends DNSProxy{
}else { }else {
pollTries++; pollTries++;
try{ try{
Os.poll(polls, timeout); Os.poll(polls, timeout/pollTries);
pollTries = 0; pollTries = 0;
} catch(ErrnoException ex){ } catch(ErrnoException ex){
if(pollTries < 3) poll(polls, timeout); if(pollTries < 3) 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