diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2003-05-22 15:23:47 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2003-05-22 15:23:47 +0000 |
| commit | 6a1cc903bf2db47b7061791b9e878ededcba1aa4 (patch) | |
| tree | 5e9d78365d85901394f312d8eed6a1811692891b /src/event/modules/ngx_aio_module.c | |
| parent | fa73aac7747c9d0a8575eb2beffcdab50171e006 (diff) | |
| download | nginx-6a1cc903bf2db47b7061791b9e878ededcba1aa4.tar.gz nginx-6a1cc903bf2db47b7061791b9e878ededcba1aa4.tar.bz2 | |
nginx-0.0.1-2003-05-22-19:23:47 import
Diffstat (limited to 'src/event/modules/ngx_aio_module.c')
| -rw-r--r-- | src/event/modules/ngx_aio_module.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/event/modules/ngx_aio_module.c b/src/event/modules/ngx_aio_module.c index 24d049f80..a5375e917 100644 --- a/src/event/modules/ngx_aio_module.c +++ b/src/event/modules/ngx_aio_module.c @@ -13,6 +13,7 @@ static int ngx_aio_init(ngx_log_t *log); static void ngx_aio_done(ngx_log_t *log); static int ngx_aio_add_event(ngx_event_t *ev, int event, u_int flags); static int ngx_aio_del_event(ngx_event_t *ev, int event, u_int flags); +static int ngx_aio_del_connection(ngx_connection_t *c); static int ngx_aio_process_events(ngx_log_t *log); @@ -39,7 +40,7 @@ ngx_event_module_t ngx_aio_module_ctx = { NULL, /* enable an event */ NULL, /* disable an event */ NULL, /* add an connection */ - NULL, /* delete an connection */ + ngx_aio_del_connection, /* delete an connection */ ngx_aio_process_events, /* process the events */ ngx_aio_init, /* init the events */ ngx_aio_done /* done the events */ @@ -94,6 +95,58 @@ static int ngx_aio_del_event(ngx_event_t *ev, int event, u_int flags) } +static int ngx_aio_del_connection(ngx_connection_t *c) +{ + int rc; + + if (c->read->active || c->write->active) { + rc = aio_cancel(c->fd, NULL); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_cancel() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_cancel: %d" _ rc); + +#if 0 + rc = aio_error(&c->read->aiocb); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_error() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_error: %d" _ rc); +#endif + } + +#if 0 + if (c->write->active) { + rc = aio_cancel(c->fd, &c->write->aiocb); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_cancel() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_cancel: %d" _ rc); + + rc = aio_error(&c->read->aiocb); + if (rc == -1) { + ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, + "aio_error() failed"); + return NGX_ERROR; + } + + ngx_log_debug(c->log, "aio_error: %d" _ rc); + } +#endif + + return NGX_OK; +} + + static int ngx_aio_process_events(ngx_log_t *log) { return ngx_kqueue_module_ctx.actions.process(log); |
