On Fri, 15 Mar 2019 at 03:43, Iñaki Baz Castillo <[email protected]> wrote:
> Indeed I confirm that, at least in Linux, uv_tcp_bind may succeed
> while the next call to uv_listen may fail with UV_EADDRINUSE.

In fact this is being super problematic for me. I have a "helper" that
gets a random TCP port and returns the corresponding uv_handle. It
just checks whether uv_tcp_bind() fails or not (here the problem, of
course). and then I use the theoretically available uv_handle into
another class in which I call uv_listen() with it.

https://github.com/versatica/mediasoup/blob/v3/worker/src/RTC/PortManager.cpp?ts=2#L182
https://github.com/versatica/mediasoup/blob/v3/worker/src/handles/TcpServer.cpp?ts=2#L37

I'm setting the corresponding uv_connection_cb in the second file, I
cannot set it in the first one (in the "helper"). Is there any
workaround for this? I mean something such as doing both uv_tcp_bind()
and uv_listen() in the "helper" and, if ok, un-listen the uv_handle
and return it (so the second file can run uv_listen() with it).


-- 
Iñaki Baz Castillo
<[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to