Refine the local socket closing logic
This commit is contained in:
@@ -70,4 +70,5 @@ public class JniHelper {
|
||||
private static native Object getExitValueMutex(Process process);
|
||||
public static native int sendFd(int fd, String path);
|
||||
public static native void close(int fd);
|
||||
public static native void unlink(String path);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,12 @@ JNIEXPORT void JNICALL Java_com_github_shadowsocks_JniHelper_close(JNIEnv *env,
|
||||
close(fd);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_github_shadowsocks_JniHelper_unlink(JNIEnv *env, jobject thiz, jstring path) {
|
||||
const char *sock_str = env->GetStringUTFChars(path, 0);
|
||||
unlink(sock_str);
|
||||
env->ReleaseStringUTFChars(path, sock_str);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_github_shadowsocks_JniHelper_sendFd(JNIEnv *env, jobject thiz, jint tun_fd, jstring path) {
|
||||
int fd;
|
||||
|
||||
Reference in New Issue
Block a user