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
020a2a5d
Commit
020a2a5d
authored
Dec 19, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine "Catch IOExpections when reading ACLs"
This commit refines
37856ab4
.
parent
7624f4ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
mobile/src/main/java/com/github/shadowsocks/acl/Acl.kt
mobile/src/main/java/com/github/shadowsocks/acl/Acl.kt
+10
-10
mobile/src/main/java/com/github/shadowsocks/widget/ServiceButton.kt
.../main/java/com/github/shadowsocks/widget/ServiceButton.kt
+2
-2
No files found.
mobile/src/main/java/com/github/shadowsocks/acl/Acl.kt
View file @
020a2a5d
...
@@ -28,6 +28,7 @@ import com.github.shadowsocks.preference.DataStore
...
@@ -28,6 +28,7 @@ import com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.utils.Subnet
import
com.github.shadowsocks.utils.Subnet
import
com.github.shadowsocks.utils.asIterable
import
com.github.shadowsocks.utils.asIterable
import
java.io.File
import
java.io.File
import
java.io.IOException
import
java.io.Reader
import
java.io.Reader
import
java.net.URL
import
java.net.URL
...
@@ -50,11 +51,7 @@ class Acl {
...
@@ -50,11 +51,7 @@ class Acl {
get
()
{
get
()
{
val
acl
=
Acl
()
val
acl
=
Acl
()
val
str
=
DataStore
.
publicStore
.
getString
(
CUSTOM_RULES
)
?:
return
acl
val
str
=
DataStore
.
publicStore
.
getString
(
CUSTOM_RULES
)
?:
return
acl
try
{
acl
.
fromReader
(
str
.
reader
())
acl
.
fromReader
(
str
.
reader
())
}
catch
(
_
:
Exception
)
{
// Ignore
}
if
(!
acl
.
bypass
)
{
if
(!
acl
.
bypass
)
{
acl
.
subnets
.
clear
()
acl
.
subnets
.
clear
()
acl
.
hostnames
.
clear
()
acl
.
hostnames
.
clear
()
...
@@ -152,14 +149,17 @@ class Acl {
...
@@ -152,14 +149,17 @@ class Acl {
return
this
return
this
}
}
fun
fromId
(
id
:
String
):
Acl
=
try
{
fromReader
(
Acl
.
getFile
(
id
).
bufferedReader
())
}
catch
(
_
:
Exception
)
{
Acl
()
}
fun
fromId
(
id
:
String
):
Acl
=
try
{
fromReader
(
Acl
.
getFile
(
id
).
bufferedReader
())
}
catch
(
_
:
IOException
)
{
this
}
fun
flatten
(
depth
:
Int
):
Acl
{
fun
flatten
(
depth
:
Int
):
Acl
{
if
(
depth
>
0
)
for
(
url
in
urls
.
asIterable
())
{
if
(
depth
>
0
)
for
(
url
in
urls
.
asIterable
())
{
val
child
=
try
{
val
child
=
Acl
()
Acl
().
fromReader
(
url
.
openStream
().
bufferedReader
(),
bypass
).
flatten
(
depth
-
1
)
try
{
}
catch
(
_
:
Exception
)
{
child
.
fromReader
(
url
.
openStream
().
bufferedReader
(),
bypass
).
flatten
(
depth
-
1
)
Acl
()
}
catch
(
_
:
IOException
)
{
continue
}
}
if
(
bypass
!=
child
.
bypass
)
{
if
(
bypass
!=
child
.
bypass
)
{
Log
.
w
(
TAG
,
"Imported network ACL has a conflicting mode set. "
+
Log
.
w
(
TAG
,
"Imported network ACL has a conflicting mode set. "
+
...
...
mobile/src/main/java/com/github/shadowsocks/widget/ServiceButton.kt
View file @
020a2a5d
...
@@ -29,7 +29,7 @@ import android.support.graphics.drawable.AnimatedVectorDrawableCompat
...
@@ -29,7 +29,7 @@ import android.support.graphics.drawable.AnimatedVectorDrawableCompat
import
android.support.v7.widget.TooltipCompat
import
android.support.v7.widget.TooltipCompat
import
android.util.AttributeSet
import
android.util.AttributeSet
import
android.view.View
import
android.view.View
import
com.github.shadowsocks.App
import
com.github.shadowsocks.App
.Companion.app
import
com.github.shadowsocks.R
import
com.github.shadowsocks.R
import
com.github.shadowsocks.bg.BaseService
import
com.github.shadowsocks.bg.BaseService
import
java.util.*
import
java.util.*
...
@@ -85,7 +85,7 @@ class ServiceButton @JvmOverloads constructor(context: Context, attrs: Attribute
...
@@ -85,7 +85,7 @@ class ServiceButton @JvmOverloads constructor(context: Context, attrs: Attribute
}
}
refreshDrawableState
()
refreshDrawableState
()
isEnabled
=
false
isEnabled
=
false
if
(
state
==
BaseService
.
CONNECTED
||
state
==
BaseService
.
STOPPED
)
App
.
app
.
handler
.
postDelayed
(
if
(
state
==
BaseService
.
CONNECTED
||
state
==
BaseService
.
STOPPED
)
app
.
handler
.
postDelayed
(
{
isEnabled
=
state
==
BaseService
.
CONNECTED
||
state
==
BaseService
.
STOPPED
},
1000
)
{
isEnabled
=
state
==
BaseService
.
CONNECTED
||
state
==
BaseService
.
STOPPED
},
1000
)
}
}
...
...
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