Keep c-ares initialized. Fixes android, which can't just be re-initialized.
Some checks failed
Build Tilde Friends / Build-All (push) Failing after 3m48s

This commit is contained in:
Cory McWilliams 2024-08-22 12:43:20 -04:00
parent 63918f0680
commit 8ac3c5ea22

View File

@ -760,6 +760,7 @@ static jint _tf_server_main(JNIEnv* env, jobject this_object, jstring files_dir,
tf_printf("That was startup.\n"); tf_printf("That was startup.\n");
ares_library_init_android(connectivity_manager); ares_library_init_android(connectivity_manager);
ares_library_init(0);
const char* files = (*env)->GetStringUTFChars(env, files_dir, NULL); const char* files = (*env)->GetStringUTFChars(env, files_dir, NULL);
const char* apk = (*env)->GetStringUTFChars(env, apk_path, NULL); const char* apk = (*env)->GetStringUTFChars(env, apk_path, NULL);
@ -797,6 +798,7 @@ static jint _tf_server_main(JNIEnv* env, jobject this_object, jstring files_dir,
(*env)->ReleaseStringUTFChars(env, apk_path, apk); (*env)->ReleaseStringUTFChars(env, apk_path, apk);
(*env)->ReleaseStringUTFChars(env, out_port_file_path, out_port_file); (*env)->ReleaseStringUTFChars(env, out_port_file_path, out_port_file);
ares_library_cleanup();
tf_mem_shutdown(); tf_mem_shutdown();
tf_printf("tf_server_main finished with %d.", result); tf_printf("tf_server_main finished with %d.", result);
@ -894,6 +896,7 @@ void tf_run_thread_start(const char* zip_path)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
_startup(argc, argv); _startup(argc, argv);
ares_library_init(0);
int result = 0; int result = 0;
if (argc >= 2) if (argc >= 2)
@ -914,6 +917,7 @@ int main(int argc, char* argv[])
result = _tf_command_run(argv[0], argc, argv); result = _tf_command_run(argv[0], argc, argv);
} }
done: done:
ares_library_cleanup();
tf_mem_shutdown(); tf_mem_shutdown();
return result; return result;
} }