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
011ed722
Commit
011ed722
authored
Nov 09, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate JniHelper.close
parent
3b614fc6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
core/src/main/java/com/github/shadowsocks/JniHelper.java
core/src/main/java/com/github/shadowsocks/JniHelper.java
+0
-1
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
+8
-3
core/src/main/jni/jni-helper.cpp
core/src/main/jni/jni-helper.cpp
+0
-4
No files found.
core/src/main/java/com/github/shadowsocks/JniHelper.java
View file @
011ed722
...
@@ -70,7 +70,6 @@ public class JniHelper {
...
@@ -70,7 +70,6 @@ public class JniHelper {
private
static
native
Integer
getExitValue
(
Process
process
);
private
static
native
Integer
getExitValue
(
Process
process
);
private
static
native
Object
getExitValueMutex
(
Process
process
);
private
static
native
Object
getExitValueMutex
(
Process
process
);
public
static
native
int
sendFd
(
int
fd
,
@NonNull
String
path
);
public
static
native
int
sendFd
(
int
fd
,
@NonNull
String
path
);
public
static
native
void
close
(
int
fd
);
@Nullable
@Nullable
public
static
native
byte
[]
parseNumericAddress
(
@NonNull
String
str
);
public
static
native
byte
[]
parseNumericAddress
(
@NonNull
String
str
);
}
}
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
View file @
011ed722
...
@@ -27,6 +27,8 @@ import android.content.pm.PackageManager
...
@@ -27,6 +27,8 @@ import android.content.pm.PackageManager
import
android.net.*
import
android.net.*
import
android.os.Build
import
android.os.Build
import
android.os.ParcelFileDescriptor
import
android.os.ParcelFileDescriptor
import
android.system.ErrnoException
import
android.system.Os
import
androidx.core.content.getSystemService
import
androidx.core.content.getSystemService
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.JniHelper
import
com.github.shadowsocks.JniHelper
...
@@ -78,15 +80,18 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
...
@@ -78,15 +80,18 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
try
{
try
{
socket
.
inputStream
.
read
()
socket
.
inputStream
.
read
()
val
fd
=
socket
.
ancillaryFileDescriptors
!!
.
single
()
!!
val
fd
=
socket
.
ancillaryFileDescriptors
!!
.
single
()
!!
val
fdInt
=
getInt
.
invoke
(
fd
)
as
Int
socket
.
outputStream
.
write
(
if
(
try
{
socket
.
outputStream
.
write
(
if
(
try
{
val
network
=
underlyingNetwork
val
network
=
underlyingNetwork
if
(
network
!=
null
&&
Build
.
VERSION
.
SDK_INT
>=
23
)
{
if
(
network
!=
null
&&
Build
.
VERSION
.
SDK_INT
>=
23
)
{
network
.
bindSocket
(
fd
)
network
.
bindSocket
(
fd
)
true
true
}
else
protect
(
fd
Int
)
}
else
protect
(
getInt
.
invoke
(
fd
)
as
Int
)
}
finally
{
}
finally
{
JniHelper
.
close
(
fdInt
)
// Trick to close file decriptor
try
{
Os
.
close
(
fd
)
}
catch
(
e
:
ErrnoException
)
{
printLog
(
e
)
}
})
0
else
1
)
})
0
else
1
)
}
catch
(
e
:
IOException
)
{
}
catch
(
e
:
IOException
)
{
printLog
(
e
)
printLog
(
e
)
...
...
core/src/main/jni/jni-helper.cpp
View file @
011ed722
...
@@ -68,10 +68,6 @@ JNIEXPORT jobject JNICALL
...
@@ -68,10 +68,6 @@ JNIEXPORT jobject JNICALL
return
env
->
GetObjectField
(
process
,
ProcessImpl_exitValueMutex
);
return
env
->
GetObjectField
(
process
,
ProcessImpl_exitValueMutex
);
}
}
JNIEXPORT
void
JNICALL
Java_com_github_shadowsocks_JniHelper_close
(
JNIEnv
*
env
,
jobject
thiz
,
jint
fd
)
{
close
(
fd
);
}
JNIEXPORT
jint
JNICALL
JNIEXPORT
jint
JNICALL
Java_com_github_shadowsocks_JniHelper_sendFd
(
JNIEnv
*
env
,
jobject
thiz
,
jint
tun_fd
,
jstring
path
)
{
Java_com_github_shadowsocks_JniHelper_sendFd
(
JNIEnv
*
env
,
jobject
thiz
,
jint
tun_fd
,
jstring
path
)
{
int
fd
;
int
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