On Fri, Nov 9, 2012 at 1:44 AM, Dhruv Matani <
dhru...@gmail.com> wrote:
> Hello,
>
> I've just started using libuv, and was wondering if there exists an
> on_error() or global on_close() callback which is fired when a socket closes
> or is disconnected, etc...
> The only thing I could figure is to call uv_close() and unless that is
> called, it seems that the socket is NOT reclaimed/close(2)ed by the system,
> and counts toward the open FD count.
> I'm looking for something similar to the exfds FDSET when used with
> select(2).
>
> Regards,
> -Dhruv.
There is no global close or error hook in libuv. It's the
responsibility of the libuv user to always uv_close() a handle.
With TCP sockets, you check the status argument in your read_cb and
write_cb. If there is an error, you close the handle.