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
3975f3f4
Commit
3975f3f4
authored
Feb 03, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disconnect as soon as binder died
parent
be79e6f8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
+1
-1
mobile/src/main/java/com/github/shadowsocks/ShadowsocksConnection.kt
...main/java/com/github/shadowsocks/ShadowsocksConnection.kt
+5
-1
No files found.
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
View file @
3975f3f4
...
@@ -196,8 +196,8 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
...
@@ -196,8 +196,8 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
override
fun
onServiceConnected
(
service
:
IShadowsocksService
)
=
changeState
(
service
.
state
)
override
fun
onServiceConnected
(
service
:
IShadowsocksService
)
=
changeState
(
service
.
state
)
override
fun
onServiceDisconnected
()
=
changeState
(
BaseService
.
IDLE
)
override
fun
onServiceDisconnected
()
=
changeState
(
BaseService
.
IDLE
)
override
fun
binderDied
()
{
override
fun
binderDied
()
{
super
.
binderDied
()
app
.
handler
.
post
{
app
.
handler
.
post
{
connection
.
disconnect
()
Executable
.
killAll
()
Executable
.
killAll
()
connection
.
connect
()
connection
.
connect
()
}
}
...
...
mobile/src/main/java/com/github/shadowsocks/ShadowsocksConnection.kt
View file @
3975f3f4
...
@@ -48,7 +48,10 @@ class ShadowsocksConnection(private val instance: Interface) : ServiceConnection
...
@@ -48,7 +48,10 @@ class ShadowsocksConnection(private val instance: Interface) : ServiceConnection
* Different from Android framework, this method will be called even when you call `detachService`.
* Different from Android framework, this method will be called even when you call `detachService`.
*/
*/
fun
onServiceDisconnected
()
{
}
fun
onServiceDisconnected
()
{
}
override
fun
binderDied
()
{
}
override
fun
binderDied
()
{
connection
.
service
=
null
connection
.
disconnect
()
}
}
}
private
var
connectionActive
=
false
private
var
connectionActive
=
false
...
@@ -109,6 +112,7 @@ class ShadowsocksConnection(private val instance: Interface) : ServiceConnection
...
@@ -109,6 +112,7 @@ class ShadowsocksConnection(private val instance: Interface) : ServiceConnection
connectionActive
=
false
connectionActive
=
false
if
(
instance
.
listenForDeath
)
binder
?.
unlinkToDeath
(
instance
,
0
)
if
(
instance
.
listenForDeath
)
binder
?.
unlinkToDeath
(
instance
,
0
)
binder
=
null
binder
=
null
service
?.
stopListeningForBandwidth
(
instance
.
serviceCallback
)
service
=
null
service
=
null
}
}
}
}
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