On Tue, Oct 31, 2000 at 02:58:48PM +0000, Ben Laurie wrote:
> Bodo Moeller wrote:
>> Talking about "real servers" -- I think Apache 1.3.14 still uses
>> blocking sockets in its select-accept-loop, which doesn't work
>> reliably on BSD.
> What do you mean "doesn't work reliably"? Works for me!
Isn't that exactly what race conditions are famous for?
If select() says that an 'accept' fd is currently readable, then the
next accept() may block anyway if a RST from the peer is detected
between select() and accept(). Non-BSD systems don't immediately
forget about connections that are reset before they are accepted
-- the next accept() will lead to ECONNRESET or EPROTO or something
like that. But on systems with the traditional BSD behaviour,
select-accept-loops have to use non-blocking accept sockets
to avoid this race condition.
To actually see this race condition in action, you'd probably
have to add a sleep(1) right before the accept(), and write
a client that connects and immediately sends a RST
(that's SO_LINGER with l_linger set to 0).
Then start a server listening on multiple ports, and connect
to one of these using this 'evil' client software.
Connections to other ports should no longer work until
there's another connection to this one port.
--
Bodo M�ller <[EMAIL PROTECTED]>
PGP http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller/0x36d2c658.html
* TU Darmstadt, Theoretische Informatik, Alexanderstr. 10, D-64283 Darmstadt
* Tel. +49-6151-16-6628, Fax +49-6151-16-6036
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]