mirror of
https://github.com/nginx/nginx.git
synced 2024-12-04 13:59:00 +08:00
use "!= NGX_OK" instead of "== NGX_ERROR"
This commit is contained in:
parent
04f7dbb9cd
commit
c9aae14a7e
@ -498,11 +498,11 @@ ngx_ssl_handshake(ngx_connection_t *c)
|
||||
|
||||
if (n == 1) {
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ ngx_ssl_handshake(ngx_connection_t *c)
|
||||
c->read->handler = ngx_ssl_handshake_handler;
|
||||
c->write->handler = ngx_ssl_handshake_handler;
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -581,7 +581,7 @@ ngx_ssl_handshake(ngx_connection_t *c)
|
||||
c->read->handler = ngx_ssl_handshake_handler;
|
||||
c->write->handler = ngx_ssl_handshake_handler;
|
||||
|
||||
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -767,7 +767,7 @@ ngx_ssl_handle_recv(ngx_connection_t *c, int n)
|
||||
c->ssl->saved_write_handler = NULL;
|
||||
c->write->ready = 1;
|
||||
|
||||
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -795,7 +795,7 @@ ngx_ssl_handle_recv(ngx_connection_t *c, int n)
|
||||
|
||||
c->write->ready = 0;
|
||||
|
||||
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -1019,7 +1019,7 @@ ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size)
|
||||
c->ssl->saved_read_handler = NULL;
|
||||
c->read->ready = 1;
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -1047,7 +1047,7 @@ ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size)
|
||||
|
||||
c->read->ready = 0;
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -1147,11 +1147,11 @@ ngx_ssl_shutdown(ngx_connection_t *c)
|
||||
c->read->handler = ngx_ssl_shutdown_handler;
|
||||
c->write->handler = ngx_ssl_shutdown_handler;
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ ngx_event_pipe(ngx_event_pipe_t *p, ngx_int_t do_write)
|
||||
|
||||
flags = (rev->eof || rev->error) ? NGX_CLOSE_EVENT : 0;
|
||||
|
||||
if (ngx_handle_read_event(rev, flags) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, flags) != NGX_OK) {
|
||||
return NGX_ABORT;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ ngx_event_pipe(ngx_event_pipe_t *p, ngx_int_t do_write)
|
||||
|
||||
if (p->downstream->fd != -1 && p->downstream->data == p->output_ctx) {
|
||||
wev = p->downstream->write;
|
||||
if (ngx_handle_write_event(wev, p->send_lowat) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, p->send_lowat) != NGX_OK) {
|
||||
return NGX_ABORT;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ ngx_http_perl_sleep_handler(ngx_http_request_t *r)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, 0) != NGX_OK) {
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ ngx_http_init_connection(ngx_connection_t *c)
|
||||
|
||||
ngx_add_timer(rev, c->listening->post_accept_timeout);
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
#if (NGX_STAT_STUB)
|
||||
ngx_atomic_fetch_add(ngx_stat_reading, -1);
|
||||
#endif
|
||||
@ -504,7 +504,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
|
||||
ngx_add_timer(rev, c->listening->post_accept_timeout);
|
||||
}
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
@ -1038,7 +1038,7 @@ ngx_http_read_request_header(ngx_http_request_t *r)
|
||||
ngx_add_timer(rev, cscf->client_header_timeout);
|
||||
}
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -1971,7 +1971,7 @@ ngx_http_set_write_handler(ngx_http_request_t *r)
|
||||
ngx_add_timer(wev, clcf->send_timeout);
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
@ -2012,7 +2012,7 @@ ngx_http_writer(ngx_http_request_t *r)
|
||||
if (!wev->ready) {
|
||||
ngx_add_timer(wev, clcf->send_timeout);
|
||||
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
}
|
||||
|
||||
@ -2024,7 +2024,7 @@ ngx_http_writer(ngx_http_request_t *r)
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
|
||||
"http writer delayed");
|
||||
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
}
|
||||
|
||||
@ -2048,7 +2048,7 @@ ngx_http_writer(ngx_http_request_t *r)
|
||||
ngx_add_timer(wev, clcf->send_timeout);
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, clcf->send_lowat) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
}
|
||||
|
||||
@ -2083,9 +2083,7 @@ ngx_http_block_reading(ngx_http_request_t *r)
|
||||
if ((ngx_event_flags & NGX_USE_LEVEL_EVENT)
|
||||
&& r->connection->read->active)
|
||||
{
|
||||
if (ngx_del_event(r->connection->read, NGX_READ_EVENT, 0)
|
||||
== NGX_ERROR)
|
||||
{
|
||||
if (ngx_del_event(r->connection->read, NGX_READ_EVENT, 0) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
}
|
||||
}
|
||||
@ -2147,7 +2145,7 @@ ngx_http_test_reading(ngx_http_request_t *r)
|
||||
|
||||
if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && rev->active) {
|
||||
|
||||
if (ngx_del_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
|
||||
if (ngx_del_event(rev, NGX_READ_EVENT, 0) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
}
|
||||
}
|
||||
@ -2241,7 +2239,7 @@ ngx_http_set_keepalive(ngx_http_request_t *r)
|
||||
|
||||
ngx_add_timer(rev, clcf->keepalive_timeout);
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_http_close_connection(c);
|
||||
return;
|
||||
}
|
||||
@ -2328,7 +2326,7 @@ ngx_http_set_keepalive(ngx_http_request_t *r)
|
||||
rev->handler = ngx_http_keepalive_handler;
|
||||
|
||||
if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) {
|
||||
if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
|
||||
if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
|
||||
ngx_http_close_connection(c);
|
||||
return;
|
||||
}
|
||||
@ -2453,7 +2451,7 @@ ngx_http_keepalive_handler(ngx_event_t *rev)
|
||||
c->log_error = NGX_ERROR_INFO;
|
||||
|
||||
if (n == NGX_AGAIN) {
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_http_close_connection(c);
|
||||
}
|
||||
|
||||
@ -2506,7 +2504,7 @@ ngx_http_set_lingering_close(ngx_http_request_t *r)
|
||||
r->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000);
|
||||
ngx_add_timer(rev, clcf->lingering_timeout);
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
return;
|
||||
}
|
||||
@ -2515,7 +2513,7 @@ ngx_http_set_lingering_close(ngx_http_request_t *r)
|
||||
wev->handler = ngx_http_empty_handler;
|
||||
|
||||
if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) {
|
||||
if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
|
||||
if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
return;
|
||||
}
|
||||
@ -2574,7 +2572,7 @@ ngx_http_lingering_close_handler(ngx_event_t *rev)
|
||||
|
||||
} while (rev->ready);
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_http_close_request(r, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
ngx_add_timer(c->read, clcf->client_body_timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
|
||||
|
||||
r->read_event_handler = ngx_http_read_discarded_request_body_handler;
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r)
|
||||
|
||||
/* rc == NGX_AGAIN */
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
c->error = 1;
|
||||
ngx_http_finalize_request(r, rc);
|
||||
return;
|
||||
|
@ -268,7 +268,7 @@ ngx_mail_auth_http_write_handler(ngx_event_t *wev)
|
||||
ngx_del_timer(wev);
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, 0) != NGX_OK) {
|
||||
ngx_close_connection(c);
|
||||
ngx_destroy_pool(ctx->pool);
|
||||
ngx_mail_session_internal_server_error(s);
|
||||
@ -894,7 +894,7 @@ ngx_mail_auth_sleep_handler(ngx_event_t *rev)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
@ -902,7 +902,7 @@ ngx_mail_auth_sleep_handler(ngx_event_t *rev)
|
||||
}
|
||||
|
||||
if (rev->active) {
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ ngx_mail_auth_http_block_read(ngx_event_t *rev)
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0,
|
||||
"mail auth http block read");
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
c = rev->data;
|
||||
s = c->data;
|
||||
|
||||
|
@ -513,7 +513,7 @@ ngx_mail_send(ngx_event_t *wev)
|
||||
}
|
||||
|
||||
if (s->out.len == 0) {
|
||||
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ ngx_mail_send(ngx_event_t *wev)
|
||||
|
||||
ngx_add_timer(c->write, cscf->timeout);
|
||||
|
||||
if (ngx_handle_write_event(c->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
return;
|
||||
}
|
||||
@ -579,7 +579,7 @@ ngx_mail_read_command(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
}
|
||||
|
||||
if (n == NGX_AGAIN) {
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_session_internal_server_error(s);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ ngx_mail_imap_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
|
||||
ngx_add_timer(c->read, cscf->timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ ngx_mail_pop3_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
|
||||
ngx_add_timer(c->read, cscf->timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ ngx_mail_proxy_block_read(ngx_event_t *rev)
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy block read");
|
||||
|
||||
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
|
||||
c = rev->data;
|
||||
s = c->data;
|
||||
|
||||
@ -664,7 +664,7 @@ ngx_mail_proxy_dummy_handler(ngx_event_t *wev)
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, wev->log, 0, "mail proxy dummy handler");
|
||||
|
||||
if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(wev, 0) != NGX_OK) {
|
||||
c = wev->data;
|
||||
s = c->data;
|
||||
|
||||
@ -947,22 +947,22 @@ ngx_mail_proxy_handler(ngx_event_t *ev)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(dst->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(dst->write, 0) != NGX_OK) {
|
||||
ngx_mail_proxy_close_session(s);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ngx_handle_read_event(dst->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(dst->read, 0) != NGX_OK) {
|
||||
ngx_mail_proxy_close_session(s);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ngx_handle_write_event(src->write, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_write_event(src->write, 0) != NGX_OK) {
|
||||
ngx_mail_proxy_close_session(s);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ngx_handle_read_event(src->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(src->read, 0) != NGX_OK) {
|
||||
ngx_mail_proxy_close_session(s);
|
||||
return;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
timeout = sscf->greeting_delay ? sscf->greeting_delay : cscf->timeout;
|
||||
ngx_add_timer(c->read, timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev)
|
||||
|
||||
ngx_add_timer(c->read, cscf->timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
return;
|
||||
}
|
||||
@ -819,7 +819,7 @@ ngx_mail_smtp_discard_command(ngx_mail_session_t *s, ngx_connection_t *c,
|
||||
}
|
||||
|
||||
if (n == NGX_AGAIN) {
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_session_internal_server_error(s);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user