fix: ignore SIGPIPE during serving

This commit is contained in:
ngn 2024-08-09 01:28:15 +03:00
parent 518dd4fb8d
commit bee0073e58
2 changed files with 4 additions and 1 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-09 00:35+0300\n"
"POT-Creation-Date: 2024-08-09 01:27+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -160,6 +160,7 @@ end:
}
void __lm_ctx_serve_signal(int sig){
pdebug(__func__, "received interrupt, stopping the server");
lm_thpool_stop(&__serve_tp);
lm_mptp_server_close(__serve_sock);
exit(1);
@ -191,6 +192,8 @@ bool lm_ctx_serve(lm_ctx_t *ctx, char *addr, uint8_t threads, __sighandler_t han
if(NULL == handler)
handler = __lm_ctx_serve_signal;
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, handler);
while ((c = lm_mptp_server_accept(__serve_sock, &saddr)) != -1) {