diff options
Diffstat (limited to 'src/udp.c')
-rw-r--r-- | src/udp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -208,7 +208,7 @@ static int meth_receivefrom(lua_State *L) | |||
208 | static int meth_getfd(lua_State *L) | 208 | static int meth_getfd(lua_State *L) |
209 | { | 209 | { |
210 | p_udp udp = (p_udp) aux_checkgroup(L, "udp{any}", 1); | 210 | p_udp udp = (p_udp) aux_checkgroup(L, "udp{any}", 1); |
211 | lua_pushnumber(L, udp->sock); | 211 | lua_pushnumber(L, (int) udp->sock); |
212 | return 1; | 212 | return 1; |
213 | } | 213 | } |
214 | 214 | ||
@@ -328,10 +328,10 @@ static int global_create(lua_State *L) | |||
328 | if (!err) { | 328 | if (!err) { |
329 | /* allocate tcp object */ | 329 | /* allocate tcp object */ |
330 | p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp)); | 330 | p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp)); |
331 | udp->sock = sock; | ||
332 | /* set its type as master object */ | ||
333 | aux_setclass(L, "udp{unconnected}", -1); | 331 | aux_setclass(L, "udp{unconnected}", -1); |
334 | /* initialize remaining structure fields */ | 332 | /* initialize remaining structure fields */ |
333 | sock_setnonblocking(&sock); | ||
334 | udp->sock = sock; | ||
335 | tm_init(&udp->tm, -1, -1); | 335 | tm_init(&udp->tm, -1, -1); |
336 | return 1; | 336 | return 1; |
337 | } else { | 337 | } else { |