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
fc3d26d6
Commit
fc3d26d6
authored
Feb 25, 2016
by
chentao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix binder ipc issue when process died unexpected
parent
1bb3a6bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
src/main/scala/com/github/shadowsocks/ServiceBoundContext.scala
...in/scala/com/github/shadowsocks/ServiceBoundContext.scala
+4
-4
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+5
-1
No files found.
src/main/scala/com/github/shadowsocks/ServiceBoundContext.scala
View file @
fc3d26d6
...
@@ -4,16 +4,15 @@ import android.content.{ComponentName, Context, Intent, ServiceConnection}
...
@@ -4,16 +4,15 @@ import android.content.{ComponentName, Context, Intent, ServiceConnection}
import
android.os.
{
RemoteException
,
IBinder
}
import
android.os.
{
RemoteException
,
IBinder
}
import
com.github.shadowsocks.aidl.
{
IShadowsocksServiceCallback
,
IShadowsocksService
}
import
com.github.shadowsocks.aidl.
{
IShadowsocksServiceCallback
,
IShadowsocksService
}
import
com.github.shadowsocks.utils.Action
import
com.github.shadowsocks.utils.Action
import
com.github.shadowsocks.utils.Utils
/**
/**
* @author Mygod
* @author Mygod
*/
*/
trait
ServiceBoundContext
extends
Context
{
trait
ServiceBoundContext
extends
Context
{
outer
=>
class
ShadowsocksServiceConnection
extends
ServiceConnection
{
class
ShadowsocksServiceConnection
extends
ServiceConnection
{
override
def
onServiceConnected
(
name
:
ComponentName
,
service
:
IBinder
)
{
override
def
onServiceConnected
(
name
:
ComponentName
,
service
:
IBinder
)
{
bgService
=
IShadowsocksService
.
Stub
.
asInterface
(
service
)
bgService
=
IShadowsocksService
.
Stub
.
asInterface
(
service
)
bgService
.
asBinder
().
linkToDeath
(
new
ShadowsocksDeathRecipient
(
outer
),
0
)
registerCallback
registerCallback
ServiceBoundContext
.
this
.
onServiceConnected
()
ServiceBoundContext
.
this
.
onServiceConnected
()
}
}
...
@@ -33,11 +32,12 @@ trait ServiceBoundContext extends Context {
...
@@ -33,11 +32,12 @@ trait ServiceBoundContext extends Context {
}
catch
{
}
catch
{
case
ignored
:
RemoteException
=>
// Nothing
case
ignored
:
RemoteException
=>
// Nothing
}
}
def
unregisterCallback
=
if
(
bgService
!=
null
&&
callback
!=
null
&&
callbackRegistered
)
try
{
def
unregisterCallback
=
if
(
bgService
!=
null
&&
callback
!=
null
&&
callbackRegistered
)
try
{
bgService
.
unregisterCallback
(
callback
)
bgService
.
unregisterCallback
(
callback
)
callbackRegistered
=
false
callbackRegistered
=
false
}
catch
{
}
catch
{
case
ignored
:
RemoteException
=>
// Nothing
case
ignored
:
RemoteException
=>
callbackRegistered
=
false
}
}
def
onServiceConnected
()
=
()
def
onServiceConnected
()
=
()
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
fc3d26d6
...
@@ -377,7 +377,11 @@ class Shadowsocks
...
@@ -377,7 +377,11 @@ class Shadowsocks
})
})
updateTraffic
(
0
,
0
,
0
,
0
)
updateTraffic
(
0
,
0
,
0
,
0
)
// Bind to the service
bindToService
()
}
// Bind to the service
def
bindToService
()
{
handler
.
post
(()
=>
attachService
)
handler
.
post
(()
=>
attachService
)
}
}
...
...
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