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
5b3d472d
Commit
5b3d472d
authored
Jan 24, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine code style
parent
56fc89f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
core/src/main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
...main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
+14
-14
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
.../src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
+1
-1
core/src/main/java/com/github/shadowsocks/database/Profile.kt
.../src/main/java/com/github/shadowsocks/database/Profile.kt
+1
-1
No files found.
core/src/main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
View file @
5b3d472d
...
@@ -92,22 +92,22 @@ class GuardedProcessPool(private val onFatal: (IOException) -> Unit) : Coroutine
...
@@ -92,22 +92,22 @@ class GuardedProcessPool(private val onFatal: (IOException) -> Unit) : Coroutine
GlobalScope
.
launch
(
Dispatchers
.
Main
)
{
onFatal
(
e
)
}
GlobalScope
.
launch
(
Dispatchers
.
Main
)
{
onFatal
(
e
)
}
}
finally
{
}
finally
{
abortChannel
.
close
()
abortChannel
.
close
()
if
(!
running
)
return
// process already exited, nothing to be done
}
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
{
if
(!
running
)
return
// process already exited, nothing to be done
try
{
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
{
Os
.
kill
(
pid
.
get
(
process
)
as
Int
,
OsConstants
.
SIGTERM
)
try
{
}
catch
(
e
:
ErrnoException
)
{
Os
.
kill
(
pid
.
get
(
process
)
as
Int
,
OsConstants
.
SIGTERM
)
if
(
e
.
errno
!=
OsConstants
.
ESRCH
)
throw
e
}
catch
(
e
:
ErrnoException
)
{
}
if
(
e
.
errno
!=
OsConstants
.
ESRCH
)
throw
e
if
(
withTimeoutOrNull
(
500
)
{
exitChannel
.
receive
()
}
!=
null
)
return
}
process
.
destroy
()
// kill the process
if
(
Build
.
VERSION
.
SDK_INT
>=
26
)
{
if
(
withTimeoutOrNull
(
1000
)
{
exitChannel
.
receive
()
}
!=
null
)
return
process
.
destroyForcibly
()
// Force to kill the process if it's still alive
}
}
exitChannel
.
receive
()
if
(
withTimeoutOrNull
(
500
)
{
exitChannel
.
receive
()
}
!=
null
)
return
}
process
.
destroy
()
// kill the process
if
(
Build
.
VERSION
.
SDK_INT
>=
26
)
{
if
(
withTimeoutOrNull
(
1000
)
{
exitChannel
.
receive
()
}
!=
null
)
return
process
.
destroyForcibly
()
// Force to kill the process if it's still alive
}
}
exitChannel
.
receive
()
}
}
}
}
...
...
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
View file @
5b3d472d
...
@@ -64,7 +64,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
...
@@ -64,7 +64,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
withTimeout
(
30_000
)
{
withTimeout
(
30_000
)
{
withContext
(
Dispatchers
.
IO
)
{
withContext
(
Dispatchers
.
IO
)
{
conn
.
outputStream
.
bufferedWriter
().
use
{
conn
.
outputStream
.
bufferedWriter
().
use
{
it
.
write
(
"sig="
+
String
(
Base64
.
encode
(
mdg
.
digest
(),
Base64
.
DEFAULT
)
))
it
.
write
(
"sig="
+
Base64
.
encodeToString
(
mdg
.
digest
(),
Base64
.
DEFAULT
))
}
}
conn
.
inputStream
.
bufferedReader
().
readText
()
conn
.
inputStream
.
bufferedReader
().
readText
()
}
}
...
...
core/src/main/java/com/github/shadowsocks/database/Profile.kt
View file @
5b3d472d
...
@@ -238,7 +238,7 @@ class Profile : Serializable {
...
@@ -238,7 +238,7 @@ class Profile : Serializable {
val
builder
=
Uri
.
Builder
()
val
builder
=
Uri
.
Builder
()
.
scheme
(
"ss"
)
.
scheme
(
"ss"
)
.
encodedAuthority
(
"%s@%s:%d"
.
format
(
Locale
.
ENGLISH
,
.
encodedAuthority
(
"%s@%s:%d"
.
format
(
Locale
.
ENGLISH
,
Base64
.
encodeToString
(
"
%s:%s"
.
format
(
Locale
.
ENGLISH
,
method
,
password
)
.
toByteArray
(),
Base64
.
encodeToString
(
"
$method:$password"
.
toByteArray
(),
Base64
.
NO_PADDING
or
Base64
.
NO_WRAP
or
Base64
.
URL_SAFE
),
Base64
.
NO_PADDING
or
Base64
.
NO_WRAP
or
Base64
.
URL_SAFE
),
if
(
host
.
contains
(
':'
))
"[$host]"
else
host
,
remotePort
))
if
(
host
.
contains
(
':'
))
"[$host]"
else
host
,
remotePort
))
val
configuration
=
PluginConfiguration
(
plugin
?:
""
)
val
configuration
=
PluginConfiguration
(
plugin
?:
""
)
...
...
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