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
e636b9f7
Commit
e636b9f7
authored
Nov 21, 2015
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable log of pdnsd
parent
f833808b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
13 deletions
+58
-13
src/main/jni/Android.mk
src/main/jni/Android.mk
+3
-3
src/main/jni/pdnsd/src/error.c
src/main/jni/pdnsd/src/error.c
+2
-0
src/main/scala/com/github/shadowsocks/BaseService.scala
src/main/scala/com/github/shadowsocks/BaseService.scala
+22
-1
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+16
-5
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+15
-4
No files found.
src/main/jni/Android.mk
View file @
e636b9f7
...
@@ -231,7 +231,7 @@ LOCAL_CFLAGS := -O2 -std=gnu99 -DUSE_IPTABLES \
...
@@ -231,7 +231,7 @@ LOCAL_CFLAGS := -O2 -std=gnu99 -DUSE_IPTABLES \
include
$(BUILD_EXECUTABLE)
include
$(BUILD_EXECUTABLE)
########################################################
########################################################
## pdnsd
library
## pdnsd
########################################################
########################################################
include
$(CLEAR_VARS)
include
$(CLEAR_VARS)
...
@@ -240,12 +240,12 @@ PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
...
@@ -240,12 +240,12 @@ PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
LOCAL_MODULE
:=
pdnsd
LOCAL_MODULE
:=
pdnsd
LOCAL_SRC_FILES
:=
$
(
PDNSD_SOURCES:
$(LOCAL_PATH)
/%
=
%
)
LOCAL_SRC_FILES
:=
$
(
PDNSD_SOURCES:
$(LOCAL_PATH)
/%
=
%
)
LOCAL_CFLAGS
:=
-Wall
-O2
-I
$(LOCAL_PATH)
/pdnsd
LOCAL_CFLAGS
:=
-
DANDROID
-
Wall
-O2
-I
$(LOCAL_PATH)
/pdnsd
include
$(BUILD_EXECUTABLE)
include
$(BUILD_EXECUTABLE)
########################################################
########################################################
## shadowsocks-libev local
library
## shadowsocks-libev local
########################################################
########################################################
include
$(CLEAR_VARS)
include
$(CLEAR_VARS)
...
...
src/main/jni/pdnsd/src/error.c
View file @
e636b9f7
...
@@ -61,6 +61,7 @@ void crash_msg(char *msg)
...
@@ -61,6 +61,7 @@ void crash_msg(char *msg)
* the optional following arguments are the arguments like in printf */
* the optional following arguments are the arguments like in printf */
void
log_message
(
int
prior
,
const
char
*
s
,
...)
void
log_message
(
int
prior
,
const
char
*
s
,
...)
{
{
#ifndef ANDROID
int
gotlock
=
0
;
int
gotlock
=
0
;
va_list
va
;
va_list
va
;
FILE
*
f
;
FILE
*
f
;
...
@@ -112,6 +113,7 @@ void log_message(int prior, const char *s, ...)
...
@@ -112,6 +113,7 @@ void log_message(int prior, const char *s, ...)
}
}
if
(
gotlock
)
if
(
gotlock
)
pthread_mutex_unlock
(
&
loglock
);
pthread_mutex_unlock
(
&
loglock
);
#endif
}
}
...
...
src/main/scala/com/github/shadowsocks/BaseService.scala
View file @
e636b9f7
...
@@ -39,6 +39,8 @@
...
@@ -39,6 +39,8 @@
package
com.github.shadowsocks
package
com.github.shadowsocks
import
java.util.
{
Timer
,
TimerTask
}
import
android.app.Notification
import
android.app.Notification
import
android.content.Context
import
android.content.Context
import
android.os.
{
Handler
,
RemoteCallbackList
}
import
android.os.
{
Handler
,
RemoteCallbackList
}
...
@@ -49,7 +51,9 @@ trait BaseService {
...
@@ -49,7 +51,9 @@ trait BaseService {
@volatile
private
var
state
=
State
.
INIT
@volatile
private
var
state
=
State
.
INIT
@volatile
private
var
callbackCount
=
0
@volatile
private
var
callbackCount
=
0
@volatile
private
var
trafficMonitorThread
:
TrafficMonitorThread
=
null
var
timer
:
Timer
=
null
var
trafficMonitorThread
:
TrafficMonitorThread
=
null
var
config
:
Config
=
null
var
config
:
Config
=
null
final
val
callbacks
=
new
RemoteCallbackList
[
IShadowsocksServiceCallback
]
final
val
callbacks
=
new
RemoteCallbackList
[
IShadowsocksServiceCallback
]
...
@@ -99,14 +103,31 @@ trait BaseService {
...
@@ -99,14 +103,31 @@ trait BaseService {
TrafficMonitor
.
reset
()
TrafficMonitor
.
reset
()
trafficMonitorThread
=
new
TrafficMonitorThread
(
this
)
trafficMonitorThread
=
new
TrafficMonitorThread
(
this
)
trafficMonitorThread
.
start
()
trafficMonitorThread
.
start
()
val
task
=
new
TimerTask
{
def
run
{
clearChildProcessStream
()
}
}
timer
=
new
Timer
(
true
)
timer
.
schedule
(
task
,
60
*
1000
,
60
*
1000
)
}
}
def
stopRunner
()
{
def
stopRunner
()
{
TrafficMonitor
.
reset
()
TrafficMonitor
.
reset
()
if
(
trafficMonitorThread
!=
null
)
{
if
(
trafficMonitorThread
!=
null
)
{
trafficMonitorThread
.
stopThread
()
trafficMonitorThread
.
stopThread
()
trafficMonitorThread
=
null
trafficMonitorThread
=
null
}
}
if
(
timer
!=
null
)
{
timer
.
cancel
()
timer
=
null
}
}
}
def
clearChildProcessStream
()
def
stopBackgroundService
()
def
stopBackgroundService
()
def
getServiceMode
:
Int
def
getServiceMode
:
Int
def
getTag
:
String
def
getTag
:
String
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
e636b9f7
...
@@ -202,7 +202,7 @@ class ShadowsocksNatService extends Service with BaseService {
...
@@ -202,7 +202,7 @@ class ShadowsocksNatService extends Service with BaseService {
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
.
mkString
(
" "
))
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
.
mkString
(
" "
))
sslocalProcess
=
new
ProcessBuilder
()
sslocalProcess
=
new
ProcessBuilder
()
.
command
(
cmd
)
.
command
(
cmd
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
}
...
@@ -230,7 +230,7 @@ class ShadowsocksNatService extends Service with BaseService {
...
@@ -230,7 +230,7 @@ class ShadowsocksNatService extends Service with BaseService {
sstunnelProcess
=
new
ProcessBuilder
()
sstunnelProcess
=
new
ProcessBuilder
()
.
command
(
cmd
)
.
command
(
cmd
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
else
{
}
else
{
...
@@ -255,7 +255,7 @@ class ShadowsocksNatService extends Service with BaseService {
...
@@ -255,7 +255,7 @@ class ShadowsocksNatService extends Service with BaseService {
sstunnelProcess
=
new
ProcessBuilder
()
sstunnelProcess
=
new
ProcessBuilder
()
.
command
(
cmdBuf
)
.
command
(
cmdBuf
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
}
}
}
...
@@ -281,7 +281,7 @@ class ShadowsocksNatService extends Service with BaseService {
...
@@ -281,7 +281,7 @@ class ShadowsocksNatService extends Service with BaseService {
pdnsdProcess
=
new
ProcessBuilder
()
pdnsdProcess
=
new
ProcessBuilder
()
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
}
...
@@ -308,7 +308,7 @@ class ShadowsocksNatService extends Service with BaseService {
...
@@ -308,7 +308,7 @@ class ShadowsocksNatService extends Service with BaseService {
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
)
redsocksProcess
=
new
ProcessBuilder
()
redsocksProcess
=
new
ProcessBuilder
()
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
}
...
@@ -429,6 +429,17 @@ class ShadowsocksNatService extends Service with BaseService {
...
@@ -429,6 +429,17 @@ class ShadowsocksNatService extends Service with BaseService {
Console
.
runRootCommand
(
http_sb
.
toArray
)
Console
.
runRootCommand
(
http_sb
.
toArray
)
}
}
override
def
clearChildProcessStream
()
{
try
{
sslocalProcess
.
getInputStream
.
skip
(
65535
)
sstunnelProcess
.
getInputStream
.
skip
(
65535
)
pdnsdProcess
.
getInputStream
.
skip
(
65535
)
redsocksProcess
.
getInputStream
.
skip
(
65535
)
}
catch
{
case
ex
:
Exception
=>
// Ignore
}
}
override
def
startRunner
(
config
:
Config
)
{
override
def
startRunner
(
config
:
Config
)
{
super
.
startRunner
(
config
)
super
.
startRunner
(
config
)
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
e636b9f7
...
@@ -214,6 +214,17 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -214,6 +214,17 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
}
}
}
override
def
clearChildProcessStream
()
{
try
{
sslocalProcess
.
getInputStream
.
skip
(
65535
)
sstunnelProcess
.
getInputStream
.
skip
(
65535
)
pdnsdProcess
.
getInputStream
.
skip
(
65535
)
tun2socksProcess
.
getInputStream
.
skip
(
65535
)
}
catch
{
case
ex
:
Exception
=>
// Ignore
}
}
override
def
startRunner
(
config
:
Config
)
{
override
def
startRunner
(
config
:
Config
)
{
super
.
startRunner
(
config
)
super
.
startRunner
(
config
)
...
@@ -345,7 +356,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -345,7 +356,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
sslocalProcess
=
new
ProcessBuilder
()
sslocalProcess
=
new
ProcessBuilder
()
.
command
(
cmd
)
.
command
(
cmd
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
}
...
@@ -372,7 +383,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -372,7 +383,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
sstunnelProcess
=
new
ProcessBuilder
()
sstunnelProcess
=
new
ProcessBuilder
()
.
command
(
cmd
)
.
command
(
cmd
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
}
...
@@ -398,7 +409,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -398,7 +409,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
pdnsdProcess
=
new
ProcessBuilder
()
pdnsdProcess
=
new
ProcessBuilder
()
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
}
}
...
@@ -492,7 +503,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -492,7 +503,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
tun2socksProcess
=
new
ProcessBuilder
()
tun2socksProcess
=
new
ProcessBuilder
()
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
command
(
cmd
.
split
(
" "
).
toSeq
)
.
redirectErrorStream
(
fals
e
)
.
redirectErrorStream
(
tru
e
)
.
start
()
.
start
()
fd
fd
...
...
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