cotag / libuv

Ruby bindings for libuv
Other
60 stars 3 forks source link

repair bindings to libuv uv_tcp_bind function #5

Closed diclophis closed 7 years ago

diclophis commented 7 years ago

@stakach this fixes an issue when bind/listening multiple TCP servers in the same reactor loop...

Without this fix, multiple calls to a_tcp_server.bind results in undefined / error behavior, in particular the catch loop on the server receives this message

"invalid argument, EINVAL:-22","Libuv::Error::EINVAL"

I think this error might only be an issue in particular on Linux platforms, as for the most part I have not seen this issue on OSX.

I plan to submit a test along with this patch, but I need to get this pushed and and integrated into my project sooner than later...

diclophis commented 7 years ago

Also of interest is these two documents

http://docs.libuv.org/en/v1.x/udp.html#c.uv_udp_bind

http://docs.libuv.org/en/v1.x/tcp.html#c.uv_tcp_bind

It looks like udp_bind was already OK... but somehow that refactor never made it to the TCP half of things

stakach commented 7 years ago

Thanks for the patch! Just FYI, I'm about to release version 3 of this GEM with major improvements!

https://github.com/cotag/libuv/tree/seamless Just finishing up some related GEMs however it is otherwise ready for release. If you clone that branch, gem build libuv.gemspec and install you can check it out. Can't emphasize enough how much better it is.

stakach commented 7 years ago

Wait, I'd already merged that branch into master

stakach commented 7 years ago

so if you build the current master manually it's much better