Skip to content

Commit 64866bc

Browse files
committed
bugfix: fixed compilation errors with nginx 1.9.11+. thanks Charles R. Portwood II and Tomas Kvasnicka for the report in #669 and #668, respectively.
1 parent b28eefa commit 64866bc

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/ngx_http_lua_socket_udp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void ngx_http_lua_socket_udp_read_handler(ngx_http_request_t *r,
5454
ngx_http_lua_socket_udp_upstream_t *u);
5555
static void ngx_http_lua_socket_udp_handle_success(ngx_http_request_t *r,
5656
ngx_http_lua_socket_udp_upstream_t *u);
57-
static ngx_int_t ngx_http_lua_udp_connect(ngx_udp_connection_t *uc);
57+
static ngx_int_t ngx_http_lua_udp_connect(ngx_http_lua_udp_connection_t *uc);
5858
static int ngx_http_lua_socket_udp_close(lua_State *L);
5959
static ngx_int_t ngx_http_lua_socket_udp_resume(ngx_http_request_t *r);
6060
static void ngx_http_lua_udp_resolve_cleanup(void *data);
@@ -170,10 +170,10 @@ ngx_http_lua_socket_udp_setpeername(lua_State *L)
170170
ngx_url_t url;
171171
ngx_int_t rc;
172172
ngx_http_lua_loc_conf_t *llcf;
173-
ngx_udp_connection_t *uc;
174173
int timeout;
175174
ngx_http_lua_co_ctx_t *coctx;
176175

176+
ngx_http_lua_udp_connection_t *uc;
177177
ngx_http_lua_socket_udp_upstream_t *u;
178178

179179
/*
@@ -642,11 +642,11 @@ ngx_http_lua_socket_resolve_retval_handler(ngx_http_request_t *r,
642642
{
643643
ngx_http_lua_ctx_t *ctx;
644644
ngx_http_lua_co_ctx_t *coctx;
645-
ngx_udp_connection_t *uc;
646645
ngx_connection_t *c;
647646
ngx_http_cleanup_t *cln;
648647
ngx_http_upstream_resolved_t *ur;
649648
ngx_int_t rc;
649+
ngx_http_lua_udp_connection_t *uc;
650650

651651
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
652652
"lua udp socket resolve retval handler");
@@ -1348,7 +1348,7 @@ ngx_http_lua_socket_udp_handle_success(ngx_http_request_t *r,
13481348

13491349

13501350
static ngx_int_t
1351-
ngx_http_lua_udp_connect(ngx_udp_connection_t *uc)
1351+
ngx_http_lua_udp_connect(ngx_http_lua_udp_connection_t *uc)
13521352
{
13531353
int rc;
13541354
ngx_int_t event;

src/ngx_http_lua_socket_udp.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,23 @@ typedef void (*ngx_http_lua_socket_udp_upstream_handler_pt)
2424
(ngx_http_request_t *r, ngx_http_lua_socket_udp_upstream_t *u);
2525

2626

27+
typedef struct {
28+
ngx_connection_t *connection;
29+
struct sockaddr *sockaddr;
30+
socklen_t socklen;
31+
ngx_str_t server;
32+
ngx_log_t log;
33+
} ngx_http_lua_udp_connection_t;
34+
35+
2736
struct ngx_http_lua_socket_udp_upstream_s {
2837
ngx_http_lua_socket_udp_retval_handler prepare_retvals;
2938
ngx_http_lua_socket_udp_upstream_handler_pt read_event_handler;
3039

3140
ngx_http_lua_loc_conf_t *conf;
3241
ngx_http_cleanup_pt *cleanup;
3342
ngx_http_request_t *request;
34-
ngx_udp_connection_t udp_connection;
43+
ngx_http_lua_udp_connection_t udp_connection;
3544

3645
ngx_msec_t read_timeout;
3746

0 commit comments

Comments
 (0)