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
5a09d46f
Commit
5a09d46f
authored
Feb 12, 2020
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UDP fallback handling in JSON parsing
Fixes #2437.
parent
5b6a6782
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
core/src/main/java/com/github/shadowsocks/database/Profile.kt
.../src/main/java/com/github/shadowsocks/database/Profile.kt
+9
-8
core/src/main/java/com/github/shadowsocks/subscription/SubscriptionService.kt
...om/github/shadowsocks/subscription/SubscriptionService.kt
+1
-1
No files found.
core/src/main/java/com/github/shadowsocks/database/Profile.kt
View file @
5a09d46f
...
...
@@ -162,7 +162,7 @@ data class Profile(
}.
filterNotNull
()
private
class
JsonParser
(
private
val
feature
:
Profile
?
=
null
)
:
ArrayList
<
Profile
>()
{
private
val
fallbackMap
=
mutableMapOf
<
Profile
,
Profile
>()
val
fallbackMap
=
mutableMapOf
<
Profile
,
Profile
>()
private
val
JsonElement
?.
optString
get
()
=
(
this
as
?
JsonPrimitive
)
?.
asString
private
val
JsonElement
?.
optBoolean
...
...
@@ -223,7 +223,7 @@ data class Profile(
}
}
fun
finalize
(
create
:
(
Profile
)
->
Unit
)
{
fun
finalize
(
create
:
(
Profile
)
->
Profile
)
{
val
profiles
=
ProfileManager
.
getAllProfiles
()
?:
emptyList
()
for
((
profile
,
fallback
)
in
fallbackMap
)
{
val
match
=
profiles
.
firstOrNull
{
...
...
@@ -231,19 +231,20 @@ data class Profile(
fallback
.
password
==
it
.
password
&&
fallback
.
method
==
it
.
method
&&
it
.
plugin
.
isNullOrEmpty
()
}
profile
.
udpFallback
=
if
(
match
==
null
)
{
create
(
fallback
)
fallback
.
id
}
else
match
.
id
profile
.
udpFallback
=
(
match
?:
create
(
fallback
)).
id
ProfileManager
.
updateProfile
(
profile
)
}
}
}
fun
parseJson
(
json
:
JsonElement
,
feature
:
Profile
?
=
null
,
create
:
(
Profile
)
->
Unit
)
{
fun
parseJson
(
json
:
JsonElement
,
feature
:
Profile
?
=
null
,
create
:
(
Profile
)
->
Profile
)
{
JsonParser
(
feature
).
run
{
process
(
json
)
for
(
profile
in
this
)
create
(
profile
)
for
(
i
in
indices
)
{
val
fallback
=
fallbackMap
.
remove
(
this
[
i
])
this
[
i
]
=
create
(
this
[
i
])
fallback
?.
also
{
fallbackMap
[
this
[
i
]]
=
it
}
}
finalize
(
create
)
}
}
...
...
core/src/main/java/com/github/shadowsocks/subscription/SubscriptionService.kt
View file @
5a09d46f
...
...
@@ -194,7 +194,7 @@ class SubscriptionService : Service(), CoroutineScope {
subscription
=
Profile
.
SubscriptionStatus
.
Active
})
}
}
}
!!
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
...
...
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