What I do not like about the current implementation is that we are
forced to always change the socket into non-blocking on a unix platform
to use timeouts.
This causes nasty things, like sendfile() returning EAGAIN all the time,
because the socket is non-blocking.
I would like to look at extending the timeout API, creating a new
version that leaves a socket in its original state (blocking or
non-blocking), but still implements the Timeouts. The SO_SNDTIMEO and
O_RCVTIMEO socketopts can do exactly this. For platforms that do not
support them, we can emulate it but toggling to non-blocking, and using
apr_wait_for_io_or_timeout, just like we do now, and then reseting the
socket to its original state.
Is there any reason SO_SNDTIMEO and SO_RCVTIMEO can't be used?
Looking quickly, they seem to be supported on most unixes with the major
exception of Solaris...
Thoughts?
Paul