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
fb7b65cf
Commit
fb7b65cf
authored
Feb 07, 2020
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close AclMatcher if init fails
parent
35ece933
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
core/src/main/java/com/github/shadowsocks/acl/AclMatcher.kt
core/src/main/java/com/github/shadowsocks/acl/AclMatcher.kt
+4
-4
No files found.
core/src/main/java/com/github/shadowsocks/acl/AclMatcher.kt
View file @
fb7b65cf
...
@@ -20,13 +20,11 @@
...
@@ -20,13 +20,11 @@
package
com.github.shadowsocks.acl
package
com.github.shadowsocks.acl
import
android.util.Log
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.net.Subnet
import
com.github.shadowsocks.net.Subnet
import
java.io.Reader
import
java.io.Reader
import
java.net.Inet4Address
import
java.net.Inet4Address
import
java.net.Inet6Address
import
java.net.Inet6Address
import
kotlin.system.measureNanoTime
class
AclMatcher
:
AutoCloseable
{
class
AclMatcher
:
AutoCloseable
{
companion
object
{
companion
object
{
...
@@ -71,7 +69,7 @@ class AclMatcher : AutoCloseable {
...
@@ -71,7 +69,7 @@ class AclMatcher : AutoCloseable {
}.
toList
()
}.
toList
()
check
(
handle
==
0L
)
check
(
handle
==
0L
)
handle
=
init
()
handle
=
init
()
val
time
=
measureNanoTime
{
try
{
val
(
bypass
,
subnets
)
=
Acl
.
parse
(
reader
,
{
val
(
bypass
,
subnets
)
=
Acl
.
parse
(
reader
,
{
check
(
addBypassDomain
(
handle
,
it
))
check
(
addBypassDomain
(
handle
,
it
))
},
{
},
{
...
@@ -81,8 +79,10 @@ class AclMatcher : AutoCloseable {
...
@@ -81,8 +79,10 @@ class AclMatcher : AutoCloseable {
subnetsIpv4
=
subnets
.
asSequence
().
filter
{
it
.
address
is
Inet4Address
}.
dedup
()
subnetsIpv4
=
subnets
.
asSequence
().
filter
{
it
.
address
is
Inet4Address
}.
dedup
()
subnetsIpv6
=
subnets
.
asSequence
().
filter
{
it
.
address
is
Inet6Address
}.
dedup
()
subnetsIpv6
=
subnets
.
asSequence
().
filter
{
it
.
address
is
Inet6Address
}.
dedup
()
this
.
bypass
=
bypass
this
.
bypass
=
bypass
}
catch
(
e
:
Exception
)
{
close
()
throw
e
}
}
Log
.
d
(
"AclMatcher"
,
"ACL initialized in $time ns"
)
}
}
private
fun
quickMatches
(
subnets
:
List
<
Subnet
.
Immutable
>,
ip
:
ByteArray
):
Boolean
{
private
fun
quickMatches
(
subnets
:
List
<
Subnet
.
Immutable
>,
ip
:
ByteArray
):
Boolean
{
...
...
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