cotag / libuv

Ruby bindings for libuv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for REUSEADDR

diclophis opened this issue · comments

Hello,

Does this library support setting REUSEADDR flags on TCP sockets?

Support added in libuv (3.1.2)

tcp = reactor.tcp(flags: REUSEADDR | SOMEOTHER_FLAG)
tcp.bind('0.0.0.0', port) do |client|
    client.progress do |data|
        client.write('pong')
    end
    client.start_read
end

Totally awesome, thanks!

Small issue... i am unable to find the resolved reference to Libuv:: REUSEADDR ...

released libuv (3.1.3)
Constants are defined here: http://www.rubydoc.info/stdlib/socket/1.9.3/Socket/Constants
Same in later versions of rubies however couldn't find the docs

Am I reading this code correctly, or is it impossible actually in libuv source to actually change the flags?

https://github.com/libuv/libuv/blob/v1.x/src/unix/tcp.c#L63

???

I think it is actually impossible not to use that flag: https://github.com/libuv/libuv/blob/v1.x/src/unix/tcp.c#L107

... haha yea, as it turns out i had a logic bug in my test suite that caused my issue... but thanks again for all the quick updates