comparison src/core/nginx.c @ 24:77c7629a2627

nginx-0.0.1-2002-12-10-21:05:12 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 10 Dec 2002 18:05:12 +0000
parents 708f8bb772ec
children 53cb81681040
comparison
equal deleted inserted replaced
23:f540a63026c9 24:77c7629a2627
16 /* STUB */ 16 /* STUB */
17 #include <ngx_http.h> 17 #include <ngx_http.h>
18 /* */ 18 /* */
19 19
20 20
21 static void ngx_set_signals(ngx_log_t *log);
21 static void ngx_open_listening_sockets(ngx_log_t *log); 22 static void ngx_open_listening_sockets(ngx_log_t *log);
22 23
23 24
24 /* STUB */ 25 /* STUB */
25 int ngx_max_conn = 512; 26 int ngx_max_conn = 512;
39 /* STUB */ 40 /* STUB */
40 ngx_log.log_level = NGX_LOG_DEBUG; 41 ngx_log.log_level = NGX_LOG_DEBUG;
41 42
42 ngx_pool = ngx_create_pool(16 * 1024, &ngx_log); 43 ngx_pool = ngx_create_pool(16 * 1024, &ngx_log);
43 /* */ 44 /* */
45
46 ngx_set_signals(&ngx_log);
44 47
45 ngx_init_sockets(&ngx_log); 48 ngx_init_sockets(&ngx_log);
46 49
47 /* TODO: read config */ 50 /* TODO: read config */
48 51
66 69
67 /* STUB */ 70 /* STUB */
68 ngx_worker(&ngx_log); 71 ngx_worker(&ngx_log);
69 72
70 return 0; 73 return 0;
74 }
75
76 static void ngx_set_signals(ngx_log_t *log)
77 {
78 struct sigaction sa;
79
80 ngx_memzero(&sa, sizeof(struct sigaction));
81 sa.sa_handler = SIG_IGN;
82 sigemptyset(&sa.sa_mask);
83 if (sigaction(SIGPIPE, &sa, NULL) == -1) {
84 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
85 "sigaction(SIGPIPE, SIG_IGN) failed");
86 exit(1);
87 }
71 } 88 }
72 89
73 static void ngx_open_listening_sockets(ngx_log_t *log) 90 static void ngx_open_listening_sockets(ngx_log_t *log)
74 { 91 {
75 int times, failed, reuseaddr, i; 92 int times, failed, reuseaddr, i;