Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: unnecessary to do error check #2371

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions src/ngx_http_lua_socket_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static int ngx_http_lua_socket_tcp_conn_op_resume_retval_handler(
ngx_http_request_t *r, ngx_http_lua_socket_tcp_upstream_t *u, lua_State *L);
static int ngx_http_lua_socket_tcp_upstream_destroy(lua_State *L);
static int ngx_http_lua_socket_downstream_destroy(lua_State *L);
static ngx_int_t ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
static void ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
ngx_http_lua_ctx_t *ctx, ngx_http_lua_socket_tcp_upstream_t *u,
lua_State *L);
static ngx_int_t ngx_http_lua_socket_add_pending_data(ngx_http_request_t *r,
Expand Down Expand Up @@ -3153,7 +3153,6 @@ ngx_http_lua_socket_tcp_receive_retval_handler(ngx_http_request_t *r,
ngx_http_lua_socket_tcp_upstream_t *u, lua_State *L)
{
int n;
ngx_int_t rc;
ngx_http_lua_ctx_t *ctx;
ngx_event_t *ev;

Expand Down Expand Up @@ -3200,12 +3199,7 @@ ngx_http_lua_socket_tcp_receive_retval_handler(ngx_http_request_t *r,
dd("u->bufs_in: %p", u->bufs_in);

if (u->bufs_in) {
rc = ngx_http_lua_socket_push_input_data(r, ctx, u, L);
if (rc == NGX_ERROR) {
lua_pushnil(L);
lua_pushliteral(L, "no memory");
return 2;
}
ngx_http_lua_socket_push_input_data(r, ctx, u, L);

(void) ngx_http_lua_socket_read_error_retval_handler(r, u, L);

Expand All @@ -3219,12 +3213,7 @@ ngx_http_lua_socket_tcp_receive_retval_handler(ngx_http_request_t *r,
return n + 1;
}

rc = ngx_http_lua_socket_push_input_data(r, ctx, u, L);
if (rc == NGX_ERROR) {
lua_pushnil(L);
lua_pushliteral(L, "no memory");
return 2;
}
ngx_http_lua_socket_push_input_data(r, ctx, u, L);

return 1;
}
Expand Down Expand Up @@ -5908,7 +5897,7 @@ ngx_http_lua_socket_downstream_destroy(lua_State *L)
}


static ngx_int_t
static void
ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
ngx_http_lua_ctx_t *ctx, ngx_http_lua_socket_tcp_upstream_t *u,
lua_State *L)
Expand Down Expand Up @@ -5980,8 +5969,6 @@ ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
u->buf_in->buf->last = u->buffer.pos;
u->buf_in->buf->pos = u->buffer.pos;
}

return NGX_OK;
}


Expand Down
Loading