JNIEXPORT jboolean JNICALL jni_freerdp_disconnect(JNIEnv *env, jclass cls, jint instance) { freerdp* inst = (freerdp*)instance; androidContext* ctx = (androidContext*)inst->context; ANDROID_EVENT* event = (ANDROID_EVENT*)android_event_disconnect_new(); if (!event) return JNI_FALSE; DEBUG_ANDROID("DISCONNECT!"); assert(inst); assert(ctx); assert(event); if (!android_push_event(inst, event)) { android_event_disconnect_free(event); return JNI_FALSE; } WaitForSingleObject(ctx->thread, INFINITE); CloseHandle(ctx->thread); ctx->thread = NULL; freerdp_callback("OnDisconnecting", "(I)V", instance); return (jboolean) JNI_TRUE; }
static jboolean JNICALL jni_freerdp_disconnect(JNIEnv* env, jclass cls, jint instance) { freerdp* inst = (freerdp*)instance; androidContext* ctx; ANDROID_EVENT* event; if (!inst || !inst->context || !cls || !env) { WLog_FATAL(TAG, "%s(env=%p, cls=%p, instance=%d", __FUNCTION__, env, cls, instance); return JNI_FALSE; } ctx = (androidContext*)inst->context; event = (ANDROID_EVENT*)android_event_disconnect_new(); if (!event) return JNI_FALSE; if (!android_push_event(inst, event)) { android_event_free((ANDROID_EVENT*)event); return JNI_FALSE; } if (!freerdp_abort_connect(inst)) return JNI_FALSE; return JNI_TRUE; }
JNIEXPORT void JNICALL jni_freerdp_cancel_connection(JNIEnv *env, jclass cls, jint instance) { DEBUG_ANDROID("Cancelling connection ..."); freerdp* inst = (freerdp*)instance; ANDROID_EVENT* event = (ANDROID_EVENT*)android_event_disconnect_new(); android_push_event(inst, event); freerdp_callback("OnDisconnecting", "(I)V", instance); }
JNIEXPORT jboolean JNICALL jni_freerdp_disconnect(JNIEnv *env, jclass cls, jint instance) { freerdp* inst = (freerdp*)instance; ANDROID_EVENT* event = (ANDROID_EVENT*)android_event_disconnect_new(); android_push_event(inst, event); freerdp_callback("OnDisconnecting", "(I)V", instance); return (jboolean) JNI_TRUE; }