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
4e22d26e
Commit
4e22d26e
authored
Jul 25, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine #100
parent
028c5a64
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
21 deletions
+22
-21
src/main/scala/com/github/shadowsocks/BaseService.scala
src/main/scala/com/github/shadowsocks/BaseService.scala
+11
-9
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+6
-8
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+4
-3
No files found.
src/main/scala/com/github/shadowsocks/BaseService.scala
View file @
4e22d26e
...
...
@@ -49,8 +49,8 @@ import android.content.Context
trait
BaseService
{
var
state
=
State
.
INIT
var
callbackCount
=
0
@volatile
var
state
=
State
.
INIT
@volatile
var
callbackCount
=
0
final
val
callbacks
=
new
RemoteCallbackList
[
IShadowsocksServiceCallback
]
...
...
@@ -105,6 +105,7 @@ trait BaseService {
handler
.
post
(
new
Runnable
{
override
def
run
()
{
if
(
state
!=
s
)
{
if
(
callbackCount
>
0
)
{
val
n
=
callbacks
.
beginBroadcast
()
for
(
i
<-
0
to
n
-
1
)
{
try
{
...
...
@@ -114,6 +115,7 @@ trait BaseService {
}
}
callbacks
.
finishBroadcast
()
}
state
=
s
}
}
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
4e22d26e
...
...
@@ -507,7 +507,7 @@ class Shadowsocks
val
intent
=
new
Intent
(
this
,
s
)
intent
.
setAction
(
Action
.
SERVICE
)
bindService
(
intent
,
connection
,
Context
.
BIND_AUTO_CREATE
)
if
(!
isVpnEnabled
)
startService
(
new
Intent
(
this
,
s
))
startService
(
new
Intent
(
this
,
s
))
}
}
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
4e22d26e
...
...
@@ -309,6 +309,11 @@ class ShadowsocksNatService extends Service with BaseService {
}
}
override
def
onStartCommand
(
intent
:
Intent
,
flags
:
Int
,
startId
:
Int
)
:
Int
=
{
Service
.
START_NOT_STICKY
}
def
killProcesses
()
{
Console
.
runRootCommand
(
Utils
.
getIptables
+
" -t nat -F OUTPUT"
)
...
...
@@ -328,10 +333,6 @@ class ShadowsocksNatService extends Service with BaseService {
Console
.
runCommand
(
ab
.
toArray
)
}
override
def
onStartCommand
(
intent
:
Intent
,
flags
:
Int
,
startId
:
Int
)
:
Int
=
{
Service
.
START_STICKY
}
def
flushDNS
()
{
Console
.
runRootCommand
(
Array
(
"ndc resolver flushdefaultif"
,
"ndc resolver flushif wlan0"
))
}
...
...
@@ -453,11 +454,9 @@ class ShadowsocksNatService extends Service with BaseService {
filter
.
addAction
(
Action
.
CLOSE
)
receiver
=
new
BroadcastReceiver
()
{
def
onReceive
(
p1
:
Context
,
p2
:
Intent
)
{
spawn
{
stopRunner
()
}
}
}
registerReceiver
(
receiver
,
filter
)
// start tracker
...
...
@@ -580,7 +579,6 @@ class ShadowsocksNatService extends Service with BaseService {
override
def
stopBackgroundService
()
{
stopRunner
()
stopSelf
()
}
override
def
getTag
=
TAG
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
4e22d26e
...
...
@@ -253,7 +253,10 @@ class ShadowsocksVpnService extends VpnService with BaseService {
notificationManager
=
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
.
asInstanceOf
[
NotificationManager
]
}
override
def
onStartCommand
(
intent
:
Intent
,
flags
:
Int
,
startId
:
Int
)
:
Int
=
{
Service
.
START_NOT_STICKY
}
override
def
onRevoke
()
{
...
...
@@ -295,11 +298,9 @@ class ShadowsocksVpnService extends VpnService with BaseService {
filter
.
addAction
(
Intent
.
ACTION_SHUTDOWN
)
receiver
=
new
BroadcastReceiver
{
def
onReceive
(
p1
:
Context
,
p2
:
Intent
)
{
spawn
{
stopRunner
()
}
}
}
registerReceiver
(
receiver
,
filter
)
changeState
(
State
.
CONNECTING
)
...
...
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