summaryrefslogtreecommitdiff
path: root/service/src
diff options
context:
space:
mode:
authortongzongzhen <[email protected]>2024-06-13 17:16:21 +0800
committertongzongzhen <[email protected]>2024-06-13 17:16:21 +0800
commit814bb9d58e398f0b9b9c13257889ff5cd61ce296 (patch)
tree703c3f63edf12650533a043bd23dfd4c9b7ccd82 /service/src
parent0f646c0d34ecae6ed1e9ed5a67d21cbd7c3a5083 (diff)
mod app unregister
Diffstat (limited to 'service/src')
-rw-r--r--service/src/app.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/service/src/app.c b/service/src/app.c
index e21d1a3..d0db9fd 100644
--- a/service/src/app.c
+++ b/service/src/app.c
@@ -57,12 +57,16 @@ free_object:
pthread_mutex_unlock(&app_main->app_list_lock);
FREE(app_object);
+ app_object = NULL;
return 0;
}
// monitor app survival
void * apps_survival_monitor(void * arg)
{
+ pthread_detach(pthread_self());
+ mr_thread_setname(pthread_self(), "apps_survival");
+
int epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (epoll_fd < 0)
{
@@ -91,19 +95,10 @@ void * apps_survival_monitor(void * arg)
struct app * app_iter = app_lookup_by_fd(sc_main_get(), fd);
/* 异常链接 */
- if (evlist[i].events & (EPOLLHUP | EPOLLERR))
+ if (evlist[i].events & (EPOLLHUP | EPOLLERR | EPOLLIN))
{
__deconstruct_app(app_iter);
}
-
- /*EOF数据到达*/
- if (evlist[i].events & EPOLLIN)
- {
- char buf[64];
- int n = read(fd, buf, sizeof(buf));
- if (n == 0)
- __deconstruct_app(app_iter);
- }
}
}
}