Klaus Demo nginx / c9aae14
use "!= NGX_OK" instead of "== NGX_ERROR" Igor Sysoev 13 years ago
11 changed file(s) with 49 addition(s) and 51 deletion(s). Raw diff Collapse all Expand all
497497
498498 if (n == 1) {
499499
500 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
500 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
501501 return NGX_ERROR;
502502 }
503503
504 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
504 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
505505 return NGX_ERROR;
506506 }
507507
568568 c->read->handler = ngx_ssl_handshake_handler;
569569 c->write->handler = ngx_ssl_handshake_handler;
570570
571 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
571 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
572572 return NGX_ERROR;
573573 }
574574
580580 c->read->handler = ngx_ssl_handshake_handler;
581581 c->write->handler = ngx_ssl_handshake_handler;
582582
583 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
583 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
584584 return NGX_ERROR;
585585 }
586586
766766 c->ssl->saved_write_handler = NULL;
767767 c->write->ready = 1;
768768
769 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
769 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
770770 return NGX_ERROR;
771771 }
772772
794794
795795 c->write->ready = 0;
796796
797 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
797 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
798798 return NGX_ERROR;
799799 }
800800
10181018 c->ssl->saved_read_handler = NULL;
10191019 c->read->ready = 1;
10201020
1021 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
1021 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
10221022 return NGX_ERROR;
10231023 }
10241024
10461046
10471047 c->read->ready = 0;
10481048
1049 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
1049 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
10501050 return NGX_ERROR;
10511051 }
10521052
11461146 c->read->handler = ngx_ssl_shutdown_handler;
11471147 c->write->handler = ngx_ssl_shutdown_handler;
11481148
1149 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
1149 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
11501150 return NGX_ERROR;
11511151 }
11521152
1153 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
1153 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
11541154 return NGX_ERROR;
11551155 }
11561156
5555
5656 flags = (rev->eof || rev->error) ? NGX_CLOSE_EVENT : 0;
5757
58 if (ngx_handle_read_event(rev, flags) == NGX_ERROR) {
58 if (ngx_handle_read_event(rev, flags) != NGX_OK) {
5959 return NGX_ABORT;
6060 }
6161
6969
7070 if (p->downstream->fd != -1 && p->downstream->data == p->output_ctx) {
7171 wev = p->downstream->write;
72 if (ngx_handle_write_event(wev, p->send_lowat) == NGX_ERROR) {
72 if (ngx_handle_write_event(wev, p->send_lowat) != NGX_OK) {
7373 return NGX_ABORT;
7474 }
7575
284284 return;
285285 }
286286
287 if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
287 if (ngx_handle_write_event(wev, 0) != NGX_OK) {
288288 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
289289 }
290290 }
214214
215215 ngx_add_timer(rev, c->listening->post_accept_timeout);
216216
217 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
217 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
218218 #if (NGX_STAT_STUB)
219219 ngx_atomic_fetch_add(ngx_stat_reading, -1);
220220 #endif
503503 ngx_add_timer(rev, c->listening->post_accept_timeout);
504504 }
505505
506 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
506 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
507507 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
508508 }
509509
10371037 ngx_add_timer(rev, cscf->client_header_timeout);
10381038 }
10391039
1040 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
1040 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
10411041 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
10421042 return NGX_ERROR;
10431043 }
19701970 ngx_add_timer(wev, clcf->send_timeout);
19711971 }
19721972
1973 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
1973 if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
19741974 ngx_http_close_request(r, 0);
19751975 return NGX_ERROR;
19761976 }
20112011 if (!wev->ready) {
20122012 ngx_add_timer(wev, clcf->send_timeout);
20132013
2014 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
2014 if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
20152015 ngx_http_close_request(r, 0);
20162016 }
20172017
20232023 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
20242024 "http writer delayed");
20252025
2026 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
2026 if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
20272027 ngx_http_close_request(r, 0);
20282028 }
20292029
20472047 ngx_add_timer(wev, clcf->send_timeout);
20482048 }
20492049
2050 if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
2050 if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
20512051 ngx_http_close_request(r, 0);
20522052 }
20532053
20822082 if ((ngx_event_flags & NGX_USE_LEVEL_EVENT)
20832083 && r->connection->read->active)
20842084 {
2085 if (ngx_del_event(r->connection->read, NGX_READ_EVENT, 0)
2086 == NGX_ERROR)
2087 {
2085 if (ngx_del_event(r->connection->read, NGX_READ_EVENT, 0) != NGX_OK) {
20882086 ngx_http_close_request(r, 0);
20892087 }
20902088 }
21462144
21472145 if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && rev->active) {
21482146
2149 if (ngx_del_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
2147 if (ngx_del_event(rev, NGX_READ_EVENT, 0) != NGX_OK) {
21502148 ngx_http_close_request(r, 0);
21512149 }
21522150 }
22402238
22412239 ngx_add_timer(rev, clcf->keepalive_timeout);
22422240
2243 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
2241 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
22442242 ngx_http_close_connection(c);
22452243 return;
22462244 }
23272325 rev->handler = ngx_http_keepalive_handler;
23282326
23292327 if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) {
2330 if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
2328 if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
23312329 ngx_http_close_connection(c);
23322330 return;
23332331 }
24522450 c->log_error = NGX_ERROR_INFO;
24532451
24542452 if (n == NGX_AGAIN) {
2455 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
2453 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
24562454 ngx_http_close_connection(c);
24572455 }
24582456
25052503 r->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000);
25062504 ngx_add_timer(rev, clcf->lingering_timeout);
25072505
2508 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
2506 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
25092507 ngx_http_close_request(r, 0);
25102508 return;
25112509 }
25142512 wev->handler = ngx_http_empty_handler;
25152513
25162514 if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) {
2517 if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
2515 if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
25182516 ngx_http_close_request(r, 0);
25192517 return;
25202518 }
25732571
25742572 } while (rev->ready);
25752573
2576 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
2574 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
25772575 ngx_http_close_request(r, 0);
25782576 return;
25792577 }
326326 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
327327 ngx_add_timer(c->read, clcf->client_body_timeout);
328328
329 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
329 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
330330 return NGX_HTTP_INTERNAL_SERVER_ERROR;
331331 }
332332
461461
462462 r->read_event_handler = ngx_http_read_discarded_request_body_handler;
463463
464 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
464 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
465465 return NGX_HTTP_INTERNAL_SERVER_ERROR;
466466 }
467467
518518
519519 /* rc == NGX_AGAIN */
520520
521 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
521 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
522522 c->error = 1;
523523 ngx_http_finalize_request(r, rc);
524524 return;
267267 ngx_del_timer(wev);
268268 }
269269
270 if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
270 if (ngx_handle_write_event(wev, 0) != NGX_OK) {
271271 ngx_close_connection(c);
272272 ngx_destroy_pool(ctx->pool);
273273 ngx_mail_session_internal_server_error(s);
893893 return;
894894 }
895895
896 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
896 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
897897 ngx_mail_close_connection(c);
898898 }
899899
901901 }
902902
903903 if (rev->active) {
904 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
904 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
905905 ngx_mail_close_connection(c);
906906 }
907907 }
11011101 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0,
11021102 "mail auth http block read");
11031103
1104 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
1104 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
11051105 c = rev->data;
11061106 s = c->data;
11071107
512512 }
513513
514514 if (s->out.len == 0) {
515 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
515 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
516516 ngx_mail_close_connection(c);
517517 }
518518
551551
552552 ngx_add_timer(c->write, cscf->timeout);
553553
554 if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
554 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
555555 ngx_mail_close_connection(c);
556556 return;
557557 }
578578 }
579579
580580 if (n == NGX_AGAIN) {
581 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
581 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
582582 ngx_mail_session_internal_server_error(s);
583583 return NGX_ERROR;
584584 }
4545
4646 ngx_add_timer(c->read, cscf->timeout);
4747
48 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
48 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
4949 ngx_mail_close_connection(c);
5050 }
5151
6666
6767 ngx_add_timer(c->read, cscf->timeout);
6868
69 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
69 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
7070 ngx_mail_close_connection(c);
7171 }
7272
200200
201201 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy block read");
202202
203 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
203 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
204204 c = rev->data;
205205 s = c->data;
206206
663663
664664 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy dummy handler");
665665
666 if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
666 if (ngx_handle_write_event(wev, 0) != NGX_OK) {
667667 c = wev->data;
668668 s = c->data;
669669
946946 return;
947947 }
948948
949 if (ngx_handle_write_event(dst->write, 0) == NGX_ERROR) {
949 if (ngx_handle_write_event(dst->write, 0) != NGX_OK) {
950950 ngx_mail_proxy_close_session(s);
951951 return;
952952 }
953953
954 if (ngx_handle_read_event(dst->read, 0) == NGX_ERROR) {
954 if (ngx_handle_read_event(dst->read, 0) != NGX_OK) {
955955 ngx_mail_proxy_close_session(s);
956956 return;
957957 }
958958
959 if (ngx_handle_write_event(src->write, 0) == NGX_ERROR) {
959 if (ngx_handle_write_event(src->write, 0) != NGX_OK) {
960960 ngx_mail_proxy_close_session(s);
961961 return;
962962 }
963963
964 if (ngx_handle_read_event(src->read, 0) == NGX_ERROR) {
964 if (ngx_handle_read_event(src->read, 0) != NGX_OK) {
965965 ngx_mail_proxy_close_session(s);
966966 return;
967967 }
227227 timeout = sscf->greeting_delay ? sscf->greeting_delay : cscf->timeout;
228228 ngx_add_timer(c->read, timeout);
229229
230 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
230 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
231231 ngx_mail_close_connection(c);
232232 }
233233
269269
270270 ngx_add_timer(c->read, cscf->timeout);
271271
272 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
272 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
273273 ngx_mail_close_connection(c);
274274 return;
275275 }
818818 }
819819
820820 if (n == NGX_AGAIN) {
821 if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
821 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
822822 ngx_mail_session_internal_server_error(s);
823823 return NGX_ERROR;
824824 }