Mercurial > hg > nginx-quic
comparison src/event/ngx_event_accept.c @ 93:738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 21 May 2003 13:28:21 +0000 |
parents | 19cc647ecd91 |
children | a23d010f356d |
comparison
equal
deleted
inserted
replaced
92:19cc647ecd91 | 93:738fe44c70d5 |
---|---|
63 ngx_log_error(NGX_LOG_ALERT, ev->log, err, | 63 ngx_log_error(NGX_LOG_ALERT, ev->log, err, |
64 "accept %s failed", ls->addr_text.data); | 64 "accept %s failed", ls->addr_text.data); |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 /* set a blocking mode for aio and non-blocking mode for others */ | |
68 | 69 |
69 #if (HAVE_INHERITED_NONBLOCK) | 70 if (ngx_inherited_nonblocking) { |
71 if ((ngx_event_flags & NGX_USE_AIO_EVENT)) { | |
72 if (ngx_blocking(s) == -1) { | |
73 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, | |
74 ngx_blocking_n " %s failed", | |
75 ls->addr_text.data); | |
76 return; | |
77 } | |
78 } | |
70 | 79 |
71 #if (HAVE_AIO_EVENT) | 80 } else { |
72 if ((ngx_event_flags & NGX_HAVE_AIO_EVENT)) { | 81 if ((ngx_event_flags & NGX_USE_AIO_EVENT) == 0) { |
73 if (ngx_blocking(s) == -1) { | 82 if (ngx_nonblocking(s) == -1) { |
74 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, | 83 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, |
75 ngx_blocking_n " %s failed", ls->addr_text.data); | 84 ngx_nonblocking_n " %s failed", |
76 return; | 85 ls->addr_text.data); |
86 return; | |
87 } | |
77 } | 88 } |
78 } | 89 } |
79 #endif | |
80 | |
81 #else /* !HAVE_INHERITED_NONBLOCK */ | |
82 | |
83 #if (HAVE_AIO_EVENT) | |
84 if (!(ngx_event_flags & NGX_HAVE_AIO_EVENT)) { | |
85 if (ngx_nonblocking(s) == -1) { | |
86 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, | |
87 ngx_nonblocking_n " %s failed", ls->addr_text.data); | |
88 return; | |
89 } | |
90 } | |
91 #else | |
92 if (ngx_nonblocking(s) == -1) { | |
93 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_socket_errno, | |
94 ngx_nonblocking_n " %s failed", ls->addr_text.data); | |
95 return; | |
96 } | |
97 #endif | |
98 | |
99 #endif /* HAVE_INHERITED_NONBLOCK */ | |
100 | |
101 | 90 |
102 rev = &ngx_read_events[s]; | 91 rev = &ngx_read_events[s]; |
103 wev = &ngx_write_events[s]; | 92 wev = &ngx_write_events[s]; |
104 c = &ngx_connections[s]; | 93 c = &ngx_connections[s]; |
105 | 94 |
128 | 117 |
129 c->fd = s; | 118 c->fd = s; |
130 c->unexpected_eof = 1; | 119 c->unexpected_eof = 1; |
131 wev->write = 1; | 120 wev->write = 1; |
132 | 121 |
133 #if (USE_KQUEUE) | |
134 wev->ready = 1; | |
135 #else | |
136 if ((ngx_event_flags & NGX_USE_AIO_EVENT) == 0) { | 122 if ((ngx_event_flags & NGX_USE_AIO_EVENT) == 0) { |
137 wev->ready = 1; | 123 wev->ready = 1; |
138 } | 124 } |
139 #endif | |
140 | |
141 /* STUB ? */ wev->timer = rev->timer = 10000; | |
142 | 125 |
143 c->ctx = ls->ctx; | 126 c->ctx = ls->ctx; |
144 c->servers = ls->servers; | 127 c->servers = ls->servers; |
145 | 128 |
146 c->log = ngx_palloc(c->pool, sizeof(ngx_log_t)); | 129 c->log = ngx_palloc(c->pool, sizeof(ngx_log_t)); |
172 | 155 |
173 #endif | 156 #endif |
174 | 157 |
175 ls->handler(c); | 158 ls->handler(c); |
176 | 159 |
177 #if (USE_KQUEUE) | |
178 | |
179 ev->available--; | |
180 | |
181 #elif (HAVE_KQUEUE) | |
182 | |
183 if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) { | 160 if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) { |
184 ev->available--; | 161 ev->available--; |
185 } | 162 } |
186 | 163 |
187 #endif | |
188 } while (ev->available); | 164 } while (ev->available); |
189 | 165 |
190 return; | 166 return; |
191 } | 167 } |