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.

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?

Regards,
Ken

-- 
MailChannels: Control Your Email
http://www.mailchannels.com

Ken Simpson, CEO
+1-604-729-1741

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

Reply via email to