Jim Klimov via Nut-upsuser writes:

So... determining that FD is to be reaped proved hard. Internet lore suggests fcntl() and poll() on the FD, but it just seems valid to them. The errno is also usually not raised (once I saw a "111: Connection refused" though). So the best dumb idea so far is to bail out if we spent the whole loop (128 attempts) and only got zero-sized read replies and no errors.

It's been my experience, that the path of least resistance is:

1) The sockets are sets to be non-blocking
2) poll()
3) If poll() says the socket is readable, and read() returns <= 0, then the socket is dead. You get no error, and read() returns 0, if the socket had an orderly shutdown.

Attachment: pgplZkvg5CnTN.pgp
Description: PGP signature

_______________________________________________
Nut-upsdev mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev

Reply via email to