Ken Simpson wrote:
Okay, I've figured out why Socket::opt_set is unable to make a socket
blocking on OpenBSD.

The APR library -- I can only guess in an attempt to be more efficient
-- caches the state of each socket object so that it can avoid making
unnecessary system calls.

Before even trying to set the blocking or nonblocking state of a
socket, it tests whether its cache says says that the socket already
has the desired blocking state set:

 if (apr_is_option_set(sock->netmask, APR_SO_NONBLOCK) != on) {
  /* Then go ahead and toggle the blocking state */
 }

Unfortunately, for a reason I don't yet understand, Apache seems to
think that all sockets are blocking to begin with -- even though on
OpenBSD this is not true. So when you try to set a socket to blocking,
Apache just skips your request because.. obviously there's no need to
set a blocking socket to blocking again.

The easy fix is to just get rid of the cache check if statement.

The permanent fix is to patch up the set_socket_vars() function in srclib/apr/network_io/unix/sockets.c so that it sets blocking off by
default on OpenBSD.

Excellent!

I'll put together a patch to do the latter and will put it up
here. Where should I send the patch so that it gets integrated with
Apache?

It's a bug in APR not Apache. Please post it to the apr dev list: http://apr.apache.org/mailing-lists.html


-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to