On 12/6/13 6:05 AM, Jack Lund wrote:
I'm running into a strange issue with libuv, which I hadn't seen before.

I'm connecting using a non-TCP socket (it's actually Bluetooth on Linux)
to a remote device. I'm creating the socket, setting it non-blocking,
and doing the connect. The connect, of course, sets errno to
EINPROGRESS, which is fine - I ignore it and return. Now, since this
isn't a TCP socket, I'm using uv_poll_init() and uv_poll_start() to poll
for the connect to occur, like so:

   this->poll_handle = new uv_poll_t;
   uv_poll_init_socket(uv_default_loop(), this->poll_handle, this->sock);
   uv_poll_start(this->poll_handle, UV_WRITABLE, onConnect);

All of this used to work (at least a couple of months ago it did).
However, I just tried it again and what's happening is that my callback
function (onConnect) is getting called with a status of -1, and the
errno is EINPROGRESS. I did an strace on the calls, just to make sure
what was happening, and it looks like the epoll() is returning
immediately because it sees the EINPROGRESS error on the socket.

This definitely worked before, so I'm not sure what changed. However, I
really need either for the uv_poll calls to ignore EINPROGRESS, or some
way of working around this so I can poll for the connect. I've tried
checking for EINPROGRESS in my callback and calling uv_poll_start()
again, but that just causes it to error out with EEXIST.


What version of libuv did you test? I don't see how you could get EINPROGRESS in your callback, on Unix, you can only get EBADF or 0, AFAIS: https://github.com/joyent/libuv/blob/master/src/unix/poll.c#L30-L50

Does the libuv test suite pass for you? It contains a few uv_poll_t test cases.

Last, do you have a small test case which reproduces this?


Cheers,

--
Saúl Ibarra Corretgé
http://bettercallsaghul.com

--
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 http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to