android: utun shutdown diagnostics + non-blocking stop + logreceiver doc
- instance_lite: cleanup moved to uasync thread (self-detach), events on start/stop - udp_log: cancel_timer before uasync_destroy, flush on stop, stopping flag - jni_bridge: fixed UDP stop order (cancel_timer → destroy → flush) - instance_lite: u_report_unfreed_blocks at all shutdown paths - chat_event: CHAT_EVT_SERVICE_STARTED/STOPPED for GUI notifications - AGENTS: logreceiver section
This commit is contained in:
1 parent
064bed06f2
commit
0216b0bf50
6 files changed
+57
-23
No files matched your search
@@ -175,6 +175,7 @@ static void* instance_thread(void* arg) {
|
||||
IL_LOGE("utun_instance_create_from_config failed");
|
||||
uasync_destroy(g_ua, 0);
|
||||
g_ua = NULL;
|
||||
u_report_unfreed_blocks();
|
||||
g_running = 0;
|
||||
return NULL;
|
||||
}
|
||||
@@ -207,6 +208,7 @@ static void* instance_thread(void* arg) {
|
||||
g_inst = NULL;
|
||||
uasync_destroy(g_ua, 0);
|
||||
g_ua = NULL;
|
||||
u_report_unfreed_blocks();
|
||||
g_running = 0;
|
||||
return NULL;
|
||||
}
|
||||
@@ -223,12 +225,28 @@ static void* instance_thread(void* arg) {
|
||||
}
|
||||
|
||||
g_running = 1;
|
||||
chat_event_post(CHAT_EVT_SERVICE_STARTED, NULL, 0);
|
||||
|
||||
while (!g_stop) {
|
||||
uasync_poll(g_ua, 100);
|
||||
}
|
||||
|
||||
IL_LOGI("poll loop exit");
|
||||
IL_LOGI("poll loop exit, cleaning up");
|
||||
|
||||
if (g_inst) {
|
||||
utun_instance_destroy(g_inst);
|
||||
g_inst = NULL;
|
||||
}
|
||||
if (g_ua) {
|
||||
uasync_destroy(g_ua, 0);
|
||||
g_ua = NULL;
|
||||
}
|
||||
u_report_unfreed_blocks();
|
||||
g_running = 0;
|
||||
chat_event_post(CHAT_EVT_SERVICE_STOPPED, NULL, 0);
|
||||
g_event_handler = NULL;
|
||||
pthread_detach(pthread_self());
|
||||
IL_LOGI("cleanup complete");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -272,27 +290,10 @@ int instance_lite_start(const char* config_text) {
|
||||
}
|
||||
|
||||
void instance_lite_stop(void) {
|
||||
if (!g_running && !g_inst) return;
|
||||
if (!g_inst && !g_running) return;
|
||||
IL_LOGI("stopping...");
|
||||
|
||||
g_stop = 1;
|
||||
if (g_ua) uasync_wakeup(g_ua);
|
||||
pthread_join(g_thread, NULL);
|
||||
|
||||
if (g_inst) {
|
||||
etcp_router_bind(g_inst, ETCP_RT_ID_CHAT_SYNC, NULL);
|
||||
chat_sync_destroy(g_inst);
|
||||
chat_core_destroy(g_inst);
|
||||
utun_instance_destroy(g_inst);
|
||||
g_inst = NULL;
|
||||
}
|
||||
if (g_ua) {
|
||||
uasync_destroy(g_ua, 0);
|
||||
g_ua = NULL;
|
||||
}
|
||||
g_running = 0;
|
||||
g_event_handler = NULL;
|
||||
IL_LOGI("stopped");
|
||||
}
|
||||
|
||||
int instance_lite_is_running(void) {
|
||||
|
||||
Reference in new issue
Block a user