Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
4f3c8c4b
Commit
4f3c8c4b
authored
Feb 09, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UnknownHostException on Chrome OS on restart
parent
c08fc40d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
.../src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
+13
-1
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
.../main/java/com/github/shadowsocks/preference/DataStore.kt
+1
-1
No files found.
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
View file @
4f3c8c4b
...
@@ -22,6 +22,8 @@ package com.github.shadowsocks.bg
...
@@ -22,6 +22,8 @@ package com.github.shadowsocks.bg
import
android.content.Context
import
android.content.Context
import
android.util.Base64
import
android.util.Base64
import
android.util.Log
import
com.crashlytics.android.Crashlytics
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.acl.AclSyncer
import
com.github.shadowsocks.acl.AclSyncer
...
@@ -82,7 +84,17 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
...
@@ -82,7 +84,17 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
// it's hard to resolve DNS on a specific interface so we'll do it here
// it's hard to resolve DNS on a specific interface so we'll do it here
if
(
profile
.
host
.
parseNumericAddress
()
==
null
)
profile
.
host
=
withTimeoutOrNull
(
10_000
)
{
if
(
profile
.
host
.
parseNumericAddress
()
==
null
)
profile
.
host
=
withTimeoutOrNull
(
10_000
)
{
GlobalScope
.
async
(
Dispatchers
.
IO
)
{
service
.
resolver
(
profile
.
host
)
}.
await
().
firstOrNull
()
var
retries
=
0
while
(
isActive
)
try
{
val
io
=
GlobalScope
.
async
(
Dispatchers
.
IO
)
{
service
.
resolver
(
profile
.
host
)
}
return
@withTimeoutOrNull
io
.
await
().
firstOrNull
()
}
catch
(
e
:
UnknownHostException
)
{
// retries are only needed on Chrome OS where arc0 is brought up/down during VPN changes
if
(!
DataStore
.
hasArc0
)
throw
e
Thread
.
yield
()
Crashlytics
.
log
(
Log
.
WARN
,
"ProxyInstance-resolver"
,
"Retry resolving attempt #${++retries}"
)
}
null
// only here for type resolving
}
?.
hostAddress
?:
throw
UnknownHostException
()
}
?.
hostAddress
?:
throw
UnknownHostException
()
}
}
...
...
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
View file @
4f3c8c4b
...
@@ -70,7 +70,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
...
@@ -70,7 +70,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
* An alternative way to detect this interface could be checking MAC address = 00:ff:aa:00:00:55, but there is no
* An alternative way to detect this interface could be checking MAC address = 00:ff:aa:00:00:55, but there is no
* reliable way of getting MAC address for now.
* reliable way of getting MAC address for now.
*/
*/
private
val
hasArc0
by
lazy
{
val
hasArc0
by
lazy
{
var
retry
=
0
var
retry
=
0
while
(
retry
<
5
)
{
while
(
retry
<
5
)
{
try
{
try
{
...
...
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