Skip to content

Commit f5f3071

Browse files
committed
it's unnecessary to do error check of ngx_http_lua_socket_push_input_data since it will always succeed
1 parent 501ebac commit f5f3071

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/ngx_http_lua_socket_tcp.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int ngx_http_lua_socket_tcp_conn_op_resume_retval_handler(
128128
ngx_http_request_t *r, ngx_http_lua_socket_tcp_upstream_t *u, lua_State *L);
129129
static int ngx_http_lua_socket_tcp_upstream_destroy(lua_State *L);
130130
static int ngx_http_lua_socket_downstream_destroy(lua_State *L);
131-
static ngx_int_t ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
131+
static void ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
132132
ngx_http_lua_ctx_t *ctx, ngx_http_lua_socket_tcp_upstream_t *u,
133133
lua_State *L);
134134
static ngx_int_t ngx_http_lua_socket_add_pending_data(ngx_http_request_t *r,
@@ -3200,12 +3200,7 @@ ngx_http_lua_socket_tcp_receive_retval_handler(ngx_http_request_t *r,
32003200
dd("u->bufs_in: %p", u->bufs_in);
32013201

32023202
if (u->bufs_in) {
3203-
rc = ngx_http_lua_socket_push_input_data(r, ctx, u, L);
3204-
if (rc == NGX_ERROR) {
3205-
lua_pushnil(L);
3206-
lua_pushliteral(L, "no memory");
3207-
return 2;
3208-
}
3203+
ngx_http_lua_socket_push_input_data(r, ctx, u, L);
32093204

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

@@ -3219,12 +3214,7 @@ ngx_http_lua_socket_tcp_receive_retval_handler(ngx_http_request_t *r,
32193214
return n + 1;
32203215
}
32213216

3222-
rc = ngx_http_lua_socket_push_input_data(r, ctx, u, L);
3223-
if (rc == NGX_ERROR) {
3224-
lua_pushnil(L);
3225-
lua_pushliteral(L, "no memory");
3226-
return 2;
3227-
}
3217+
ngx_http_lua_socket_push_input_data(r, ctx, u, L);
32283218

32293219
return 1;
32303220
}
@@ -5908,7 +5898,7 @@ ngx_http_lua_socket_downstream_destroy(lua_State *L)
59085898
}
59095899

59105900

5911-
static ngx_int_t
5901+
static void
59125902
ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
59135903
ngx_http_lua_ctx_t *ctx, ngx_http_lua_socket_tcp_upstream_t *u,
59145904
lua_State *L)
@@ -5980,8 +5970,6 @@ ngx_http_lua_socket_push_input_data(ngx_http_request_t *r,
59805970
u->buf_in->buf->last = u->buffer.pos;
59815971
u->buf_in->buf->pos = u->buffer.pos;
59825972
}
5983-
5984-
return NGX_OK;
59855973
}
59865974

59875975

0 commit comments

Comments
 (0)