fix: ignore SIGPIPE during serving
This commit is contained in:
parent
518dd4fb8d
commit
bee0073e58
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -160,6 +160,7 @@ end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void __lm_ctx_serve_signal(int sig){
|
void __lm_ctx_serve_signal(int sig){
|
||||||
|
pdebug(__func__, "received interrupt, stopping the server");
|
||||||
lm_thpool_stop(&__serve_tp);
|
lm_thpool_stop(&__serve_tp);
|
||||||
lm_mptp_server_close(__serve_sock);
|
lm_mptp_server_close(__serve_sock);
|
||||||
exit(1);
|
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)
|
if(NULL == handler)
|
||||||
handler = __lm_ctx_serve_signal;
|
handler = __lm_ctx_serve_signal;
|
||||||
|
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
signal(SIGINT, handler);
|
signal(SIGINT, handler);
|
||||||
|
|
||||||
while ((c = lm_mptp_server_accept(__serve_sock, &saddr)) != -1) {
|
while ((c = lm_mptp_server_accept(__serve_sock, &saddr)) != -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user