Mercurial > hg > nginx-quic
comparison src/event/modules/ngx_epoll_module.c @ 253:b6793bc5034b
nginx-0.0.2-2004-02-09-10:46:43 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 09 Feb 2004 07:46:43 +0000 |
parents | 008276b9e061 |
children | 8e39cab6abd5 |
comparison
equal
deleted
inserted
replaced
252:84b1c672ec5a | 253:b6793bc5034b |
---|---|
200 } else { | 200 } else { |
201 event = EPOLLOUT; | 201 event = EPOLLOUT; |
202 } | 202 } |
203 #endif | 203 #endif |
204 | 204 |
205 ee.events = event; | 205 ee.events = event|EPOLLET; |
206 ee.data.ptr = (void *) ((uintptr_t) c | c->read->instance); | 206 ee.data.ptr = (void *) ((uintptr_t) c | c->read->instance); |
207 | 207 |
208 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, | 208 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
209 "epoll add event: fd:%d ev:%04X", c->fd, ee.events); | 209 "epoll add event: fd:%d ev:%08X", c->fd, ee.events); |
210 | 210 |
211 if (epoll_ctl(ep, EPOLL_CTL_ADD, c->fd, &ee) == -1) { | 211 if (epoll_ctl(ep, EPOLL_CTL_ADD, c->fd, &ee) == -1) { |
212 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, | 212 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, |
213 "epoll_ctl(EPOLL_CTL_MOD, %d) failed", c->fd); | 213 "epoll_ctl(EPOLL_CTL_MOD, %d) failed", c->fd); |
214 return NGX_ERROR; | 214 return NGX_ERROR; |
228 c = ev->data; | 228 c = ev->data; |
229 | 229 |
230 ee.events = 0; | 230 ee.events = 0; |
231 ee.data.ptr = NULL; | 231 ee.data.ptr = NULL; |
232 | 232 |
233 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, | 233 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
234 "epoll del event: fd:%d ev:%04X", c->fd, ee.events); | 234 "epoll del event: fd:%d", c->fd); |
235 | 235 |
236 if (epoll_ctl(ep, EPOLL_CTL_DEL, c->fd, &ee) == -1) { | 236 if (epoll_ctl(ep, EPOLL_CTL_DEL, c->fd, &ee) == -1) { |
237 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, | 237 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, |
238 "epoll_ctl(EPOLL_CTL_MOD, %d) failed", c->fd); | 238 "epoll_ctl(EPOLL_CTL_MOD, %d) failed", c->fd); |
239 return NGX_ERROR; | 239 return NGX_ERROR; |
247 | 247 |
248 static int ngx_epoll_add_connection(ngx_connection_t *c) | 248 static int ngx_epoll_add_connection(ngx_connection_t *c) |
249 { | 249 { |
250 struct epoll_event ee; | 250 struct epoll_event ee; |
251 | 251 |
252 ee.events = EPOLLIN|EPOLLOUT; | 252 ee.events = EPOLLIN|EPOLLOUT|EPOLLET; |
253 ee.data.ptr = (void *) ((uintptr_t) c | c->read->instance); | 253 ee.data.ptr = (void *) ((uintptr_t) c | c->read->instance); |
254 | 254 |
255 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, | 255 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
256 "epoll add connection: fd:%d ev:%04X", c->fd, ee.events); | 256 "epoll add connection: fd:%d ev:%08X", c->fd, ee.events); |
257 | 257 |
258 if (epoll_ctl(ep, EPOLL_CTL_ADD, c->fd, &ee) == -1) { | 258 if (epoll_ctl(ep, EPOLL_CTL_ADD, c->fd, &ee) == -1) { |
259 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, | 259 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, |
260 "epoll_ctl(EPOLL_CTL_ADD, %d) failed", c->fd); | 260 "epoll_ctl(EPOLL_CTL_ADD, %d) failed", c->fd); |
261 return NGX_ERROR; | 261 return NGX_ERROR; |
353 "epoll: stale event " PTR_FMT, c); | 353 "epoll: stale event " PTR_FMT, c); |
354 continue; | 354 continue; |
355 } | 355 } |
356 | 356 |
357 if (event_list[i].events & (EPOLLERR|EPOLLHUP)) { | 357 if (event_list[i].events & (EPOLLERR|EPOLLHUP)) { |
358 ngx_log_error(NGX_LOG_ALERT, log, 0, | 358 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0, |
359 "epoll_wait() error on fd:%d ev:%d", | 359 "epoll_wait() error on fd:%d ev:%04X", |
360 c->fd, event_list[i].events); | 360 c->fd, event_list[i].events); |
361 } | 361 } |
362 | 362 |
363 if (event_list[i].events & ~(EPOLLIN|EPOLLOUT|EPOLLERR|EPOLLHUP)) { | 363 if (event_list[i].events & ~(EPOLLIN|EPOLLOUT|EPOLLERR|EPOLLHUP)) { |
364 ngx_log_error(NGX_LOG_ALERT, log, 0, | 364 ngx_log_error(NGX_LOG_ALERT, log, 0, |
365 "strange epoll_wait() events fd:%d ev:%04X", | 365 "strange epoll_wait() events fd:%d ev:%04X", |