richardhundt / luv

libuv bindings for Lua
Apache License 2.0
118 stars 19 forks source link

socket:getsockopt(int) does not work while socket:getsockopt(string) does #11

Closed miko closed 12 years ago

miko commented 12 years ago

Hello, after receiving a packet, arguments given as a number fot getsockopt do not work, only strings do. For example: socket:getsockopt('RCVMORE') - works socket:getsockopt(luv.zmq.RCVMORE) - does not work

The reason is this code in src/luv_zmq.c in function luv_zmq_socket_getsockopt:

if (lua_isstring(L, 2)) {

which is true for strings as well as numbers. This should be changed to:

if (lua_type(L, 2) == LUA_TSTRING ) {

then it works OK.

richardhundt commented 12 years ago

fixed in git HEAD