This commit is contained in:
2026-06-18 18:13:12 +08:00
parent 2f42b036a9
commit 25f7ef1967
34 changed files with 2107 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -50,10 +50,10 @@ typedef void (*sighandler_t) (int sig) ;
void Signal(int sig, sighandler_t handler){
struct sigaction sa;
sa.sa_handler = sigchld_handler;
sa.sa_handler = handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART; // 确保被信号中断的系统调用自动重启
sigaction(SIGCHLD, &sa, NULL);
sigaction(sig, &sa, NULL);
}
@@ -80,6 +80,9 @@ int main(int argc, char **argv)
}
port = atoi(argv[1]);
//设置SIGHLD的信号处理函数用于收割结束的子进程
Signal(SIGCHLD, sigchld_handler);
Signal(SIGPIPE, SIG_IGN);
listen_sock = open_listen_sock(port);
for (hit=1; ; hit++) { //hit为第几次请求或第几次http事务

Binary file not shown.