fix: ignore SIGPIPE during serving
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user