From mud-dev (of course)

From: Oliver Jowett <icecube@ihug.co.nz>

Apache appears to use a mutex to make sure that only one child is
attempting to select on the accepting socket at once (it's set up once, in
the parent).  This isn't really the same as the problem here since we
don't want to completely block the child servers..

Perhaps something like:

- Parent sets up accepting socket on well-known port

- Parent does the select() on the accepting socket. When a connection is
  ready to be accepted, it picks a free child and sends it a control
  message to that child saying "accept a connection now".

- When a child gets this message, it calls accept() on the accepting
  socket and starts handling that connection.

- If the parent finds there are no free children, it starts a new one
  (inheriting the common accepting socket)

- When a child gets full, it sends a message to the parent saying "no more
  connections for me please". When it gets space again, it sends the
  opposite message. The parent keeps track of which children are free
  to accept new connections based on these messages.

- If a child gets a "accept a connection" message and it's full, it sends
  an appropriate message to the server to farm it out again (this is
  possible if the "I'm full" message didn't arrive in time)

Might work. This would also let you balance the connection load between
several children (assuming the children do a bit more than just
en/decapsulate and pass on data)

-O

