summaryrefslogtreecommitdiffhomepage
path: root/src/event
diff options
context:
space:
mode:
Diffstat (limited to 'src/event')
-rw-r--r--src/event/modules/ngx_aio_module.c55
-rw-r--r--src/event/ngx_event.h1
2 files changed, 55 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);
diff --git a/src/event/ngx_event.h b/src/event/ngx_event.h
index c3f925f58..1df1ad39f 100644
--- a/src/event/ngx_event.h
+++ b/src/event/ngx_event.h
@@ -280,6 +280,7 @@ typedef struct {
#define ngx_process_events ngx_event_actions.process
#define ngx_add_event ngx_event_actions.add
#define ngx_del_event ngx_event_actions.del
+#define ngx_del_conn ngx_event_actions.del_conn
#if 0
#define ngx_add_timer ngx_event_actions.timer