mirror of
https://github.com/fumiama/simple-http-server.git
synced 2026-06-10 21:16:26 +08:00
优化代码结构
This commit is contained in:
3
server.c
3
server.c
@@ -86,7 +86,6 @@ static void accept_request(void *cli) {
|
|||||||
|
|
||||||
signal(SIGQUIT, handle_quit);
|
signal(SIGQUIT, handle_quit);
|
||||||
signal(SIGPIPE, handle_quit);
|
signal(SIGPIPE, handle_quit);
|
||||||
pthread_detach(pthread_self());
|
|
||||||
|
|
||||||
numchars = get_line(client, buf, sizeof(buf));
|
numchars = get_line(client, buf, sizeof(buf));
|
||||||
j = 0;
|
j = 0;
|
||||||
@@ -523,7 +522,7 @@ static void unimplemented(int client) {
|
|||||||
static pthread_attr_t attr;
|
static pthread_attr_t attr;
|
||||||
static int accept_client(int is_unix_sock) {
|
static int accept_client(int is_unix_sock) {
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, 1);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
signal(SIGCHLD, SIG_IGN);
|
signal(SIGCHLD, SIG_IGN);
|
||||||
while(1) {
|
while(1) {
|
||||||
socklen_t client_name_len = sizeof(client_name);
|
socklen_t client_name_len = sizeof(client_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user