Skip to content

Commit 33ee7ae

Browse files
bugfix: compilation failed on windows. (#245)
1 parent 451b0f8 commit 33ee7ae

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/ngx_stream_lua_socket_udp.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ static int ngx_stream_lua_socket_udp_close(lua_State *L);
7171
static ngx_int_t ngx_stream_lua_socket_udp_resume(ngx_stream_lua_request_t *r);
7272
static void ngx_stream_lua_udp_resolve_cleanup(void *data);
7373
static void ngx_stream_lua_udp_socket_cleanup(void *data);
74+
#ifndef NGX_WIN32
7475
static ssize_t ngx_stream_lua_udp_sendmsg(ngx_connection_t *c,
7576
ngx_iovec_t *vec);
77+
#endif
7678

7779

7880
enum {
@@ -788,8 +790,10 @@ ngx_stream_lua_socket_udp_send(lua_State *L)
788790
int type;
789791
const char *msg;
790792
ngx_str_t query;
793+
#ifndef NGX_WIN32
791794
ngx_iovec_t vec;
792795
struct iovec iovs[1];
796+
#endif
793797

794798
ngx_stream_lua_socket_udp_upstream_t *u;
795799
ngx_stream_lua_loc_conf_t *llcf;
@@ -924,7 +928,11 @@ ngx_stream_lua_socket_udp_send(lua_State *L)
924928
#endif
925929

926930
dd("sending query %.*s", (int) query.len, query.data);
931+
#ifdef NGX_WIN32
932+
n = ngx_udp_send(u->udp_connection.connection, query.data, query.len);
933+
dd("ngx_udp_send returns %d (query len %d)", (int) n, (int) query.len);
927934

935+
#else
928936
vec.iovs = iovs;
929937
vec.nalloc = 1;
930938
vec.count = 1;
@@ -935,6 +943,7 @@ ngx_stream_lua_socket_udp_send(lua_State *L)
935943

936944
dd("ngx_stream_lua_udp_sendmsg returns %d (query len %d)",
937945
(int) n, (int) query.len);
946+
#endif
938947

939948
if (n == NGX_ERROR || n == NGX_AGAIN) {
940949
u->socket_errno = ngx_socket_errno;
@@ -1808,6 +1817,8 @@ ngx_stream_lua_req_socket_udp(lua_State *L)
18081817
}
18091818

18101819

1820+
#ifndef NGX_WIN32
1821+
18111822
static ssize_t
18121823
ngx_stream_lua_udp_sendmsg(ngx_connection_t *c, ngx_iovec_t *vec)
18131824
{
@@ -1946,4 +1957,6 @@ ngx_stream_lua_udp_sendmsg(ngx_connection_t *c, ngx_iovec_t *vec)
19461957
return n;
19471958
}
19481959

1960+
#endif
1961+
19491962
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

0 commit comments

Comments
 (0)