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
d240f2bd
Commit
d240f2bd
authored
Aug 20, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure broadcast is finished
parent
b4f97b88
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+12
-8
No files found.
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
d240f2bd
...
@@ -94,7 +94,7 @@ object BaseService {
...
@@ -94,7 +94,7 @@ object BaseService {
}
}
class
Binder
(
private
var
data
:
Data
?
=
null
)
:
IShadowsocksService
.
Stub
(),
CoroutineScope
,
AutoCloseable
{
class
Binder
(
private
var
data
:
Data
?
=
null
)
:
IShadowsocksService
.
Stub
(),
CoroutineScope
,
AutoCloseable
{
val
callbacks
=
object
:
RemoteCallbackList
<
IShadowsocksServiceCallback
>()
{
private
val
callbacks
=
object
:
RemoteCallbackList
<
IShadowsocksServiceCallback
>()
{
override
fun
onCallbackDied
(
callback
:
IShadowsocksServiceCallback
?,
cookie
:
Any
?)
{
override
fun
onCallbackDied
(
callback
:
IShadowsocksServiceCallback
?,
cookie
:
Any
?)
{
super
.
onCallbackDied
(
callback
,
cookie
)
super
.
onCallbackDied
(
callback
,
cookie
)
stopListeningForBandwidth
(
callback
?:
return
)
stopListeningForBandwidth
(
callback
?:
return
)
...
@@ -112,7 +112,9 @@ object BaseService {
...
@@ -112,7 +112,9 @@ object BaseService {
}
}
private
fun
broadcast
(
work
:
(
IShadowsocksServiceCallback
)
->
Unit
)
{
private
fun
broadcast
(
work
:
(
IShadowsocksServiceCallback
)
->
Unit
)
{
repeat
(
callbacks
.
beginBroadcast
())
{
val
count
=
callbacks
.
beginBroadcast
()
try
{
repeat
(
count
)
{
try
{
try
{
work
(
callbacks
.
getBroadcastItem
(
it
))
work
(
callbacks
.
getBroadcastItem
(
it
))
}
catch
(
_
:
RemoteException
)
{
}
catch
(
_
:
RemoteException
)
{
...
@@ -120,8 +122,10 @@ object BaseService {
...
@@ -120,8 +122,10 @@ object BaseService {
printLog
(
e
)
printLog
(
e
)
}
}
}
}
}
finally
{
callbacks
.
finishBroadcast
()
callbacks
.
finishBroadcast
()
}
}
}
private
suspend
fun
loop
()
{
private
suspend
fun
loop
()
{
while
(
true
)
{
while
(
true
)
{
...
...
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