Mercurial > hg > nginx
comparison src/event/modules/ngx_aio_module.c @ 95:b48066122884
nginx-0.0.1-2003-05-23-15:53:01 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 23 May 2003 11:53:01 +0000 |
parents | 8220378432a8 |
children | a23d010f356d |
comparison
equal
deleted
inserted
replaced
94:8220378432a8 | 95:b48066122884 |
---|---|
79 { | 79 { |
80 ngx_kqueue_module_ctx.actions.done(log); | 80 ngx_kqueue_module_ctx.actions.done(log); |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 /* The event adding and deleteing are needed for the listening sockets */ | 84 /* The event adding and deleting are needed for the listening sockets */ |
85 | 85 |
86 static int ngx_aio_add_event(ngx_event_t *ev, int event, u_int flags) | 86 static int ngx_aio_add_event(ngx_event_t *ev, int event, u_int flags) |
87 { | 87 { |
88 return ngx_kqueue_module_ctx.actions.add(ev, event, flags); | 88 return ngx_kqueue_module_ctx.actions.add(ev, event, flags); |
89 } | 89 } |
97 | 97 |
98 static int ngx_aio_del_connection(ngx_connection_t *c) | 98 static int ngx_aio_del_connection(ngx_connection_t *c) |
99 { | 99 { |
100 int rc; | 100 int rc; |
101 | 101 |
102 if (c->read->active || c->write->active) { | 102 if (c->read->active == 0 && c->write->active == 0) { |
103 rc = aio_cancel(c->fd, NULL); | 103 return NGX_OK; |
104 if (rc == -1) { | 104 } |
105 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, | 105 |
106 "aio_cancel() failed"); | 106 rc = aio_cancel(c->fd, NULL); |
107 return NGX_ERROR; | 107 |
108 } | 108 ngx_log_debug(c->log, "aio_cancel: %d" _ rc); |
109 | 109 |
110 ngx_log_debug(c->log, "aio_cancel: %d" _ rc); | 110 if (rc == AIO_CANCELED) { |
111 | 111 c->read->active = c->write->active = 0; |
112 #if 0 | 112 return NGX_OK; |
113 rc = aio_error(&c->read->aiocb); | 113 } |
114 if (rc == -1) { | 114 |
115 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, | 115 if (rc == AIO_ALLDONE) { |
116 "aio_error() failed"); | 116 c->read->active = c->write->active = 0; |
117 return NGX_ERROR; | 117 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
118 } | 118 "aio_cancel() returned AIO_ALLDONE"); |
119 | 119 return NGX_OK; |
120 ngx_log_debug(c->log, "aio_error: %d" _ rc); | 120 } |
121 #endif | 121 |
122 } | 122 if (rc == -1) { |
123 | 123 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno, |
124 #if 0 | 124 "aio_cancel() failed"); |
125 if (c->write->active) { | 125 return NGX_ERROR; |
126 rc = aio_cancel(c->fd, &c->write->aiocb); | 126 } |
127 if (rc == -1) { | 127 |
128 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, | 128 if (rc == AIO_NOTCANCELED) { |
129 "aio_cancel() failed"); | 129 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
130 return NGX_ERROR; | 130 "aio_cancel() returned AIO_NOTCANCELED"); |
131 } | 131 |
132 | 132 return NGX_ERROR; |
133 ngx_log_debug(c->log, "aio_cancel: %d" _ rc); | 133 } |
134 | |
135 rc = aio_error(&c->read->aiocb); | |
136 if (rc == -1) { | |
137 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_errno, | |
138 "aio_error() failed"); | |
139 return NGX_ERROR; | |
140 } | |
141 | |
142 ngx_log_debug(c->log, "aio_error: %d" _ rc); | |
143 } | |
144 #endif | |
145 | 134 |
146 return NGX_OK; | 135 return NGX_OK; |
147 } | 136 } |
148 | 137 |
149 | 138 |
150 static int ngx_aio_process_events(ngx_log_t *log) | 139 static int ngx_aio_process_events(ngx_log_t *log) |
151 { | 140 { |
152 return ngx_kqueue_module_ctx.actions.process(log); | 141 return ngx_kqueue_module_ctx.actions.process(log); |
153 } | 142 } |
154 | 143 |
155 #endif | 144 #endif /* HAVE_KQUEUE */ |
156 | 145 |
157 | 146 |
158 #if 0 | 147 #if 0 |
159 | 148 |
160 /* 1 */ | 149 /* 1 */ |