Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wade
DnsChanger
Commits
f1d0ae56
Commit
f1d0ae56
authored
Apr 13, 2018
by
Daniel Wolf
Browse files
Use a timeout for the poll
parent
8a9f939e
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/dnschanger/util/dnsproxy/DNSTCPProxy.java
View file @
f1d0ae56
...
...
@@ -157,7 +157,7 @@ public class DNSTCPProxy extends DNSProxy{
pollingFd
.
fd
=
ParcelFileDescriptor
.
fromSocket
(
socket
).
getFileDescriptor
();
pollingFd
.
events
=
(
short
)
OsConstants
.
POLLIN
;
}
poll
(
polls
,
-
1
);
poll
(
polls
,
3000
);
}
if
(
blockFd
.
revents
!=
0
){
shouldRun
=
false
;
...
...
@@ -187,7 +187,7 @@ public class DNSTCPProxy extends DNSProxy{
}
else
{
pollTries
++;
try
{
Os
.
poll
(
polls
,
timeout
);
Os
.
poll
(
polls
,
timeout
/
pollTries
);
pollTries
=
0
;
}
catch
(
ErrnoException
ex
){
if
(
pollTries
<
3
)
poll
(
polls
,
timeout
);
...
...
app/src/main/java/com/frostnerd/dnschanger/util/dnsproxy/DNSUDPProxy.java
View file @
f1d0ae56
...
...
@@ -148,7 +148,7 @@ public class DNSUDPProxy extends DNSProxy{
pollingFd
.
fd
=
ParcelFileDescriptor
.
fromDatagramSocket
(
socket
).
getFileDescriptor
();
pollingFd
.
events
=
(
short
)
OsConstants
.
POLLIN
;
}
poll
(
polls
,
-
1
);
poll
(
polls
,
3000
);
}
if
(
blockFd
.
revents
!=
0
){
shouldRun
=
false
;
...
...
@@ -178,7 +178,7 @@ public class DNSUDPProxy extends DNSProxy{
}
else
{
pollTries
++;
try
{
Os
.
poll
(
polls
,
timeout
);
Os
.
poll
(
polls
,
timeout
/
pollTries
);
pollTries
=
0
;
}
catch
(
ErrnoException
ex
){
if
(
pollTries
<
3
)
poll
(
polls
,
timeout
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment