mirror of
https://github.com/M66B/NetGuard.git
synced 2025-01-30 19:31:26 +00:00
Merge pull request #507 from zhkl0228/master
Bug fix for sdk initializer.
This commit is contained in:
commit
594e2001b1
2 changed files with 3 additions and 3 deletions
|
@ -98,6 +98,7 @@ JNIEXPORT jlong JNICALL
|
|||
Java_eu_faircode_netguard_ServiceSinkhole_jni_1init(
|
||||
JNIEnv *env, jobject instance, jint sdk) {
|
||||
struct context *ctx = calloc(1, sizeof(struct context));
|
||||
ctx->sdk = sdk;
|
||||
|
||||
loglevel = ANDROID_LOG_WARN;
|
||||
|
||||
|
@ -408,7 +409,7 @@ void report_error(const struct arguments *args, jint error, const char *fmt, ...
|
|||
static jmethodID midProtect = NULL;
|
||||
|
||||
int protect_socket(const struct arguments *args, int socket) {
|
||||
if (args->sdk >= 21)
|
||||
if (args->ctx->sdk >= 21)
|
||||
return 0;
|
||||
|
||||
jclass cls = (*args->env)->GetObjectClass(args->env, args->instance);
|
||||
|
|
|
@ -73,14 +73,13 @@ struct context {
|
|||
pthread_mutex_t lock;
|
||||
int pipefds[2];
|
||||
int stopping;
|
||||
int tun;
|
||||
int sdk;
|
||||
struct ng_session *ng_session;
|
||||
};
|
||||
|
||||
struct arguments {
|
||||
JNIEnv *env;
|
||||
jobject instance;
|
||||
int sdk;
|
||||
int tun;
|
||||
jboolean fwd53;
|
||||
jint rcode;
|
||||
|
|
Loading…
Reference in a new issue