httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: sockets and such
Date Thu, 10 Oct 2002 15:38:22 GMT
On Thu, 10 Oct 2002, Randall Stewart wrote:

> wrote:
> > On Thu, 10 Oct 2002, Randall Stewart wrote:
> > 
> > 
> >>Hi:
> >>
> >>I am working on getting apache2 (2.0.43) to be able
> >>to listen on SCTP sockets as well as TCP.
> >>
> >>This involves a small amount of work expanding the
> >>socket_t to have a protocol field.
> > 
> > 
> > It should be possible to do this without any core changes, as an initial
> > implementation.  One of the goals for Apache 2.0, was to allow the socket
> > to be abstracted out of the server by a module.  If you create your own
> > module, that implements listening for an SCTP socket, everything should
> > just work.
> > 
> > For an example of how to do this, take a look at perchild and how I
> > inserted the Unix domain socket into the listen_rec list.
> > 
> Hmm. yes this was one of the things I have looked at.. it is not
> quite as easy as that though..
> The problem is in the fact that SCTP and TCP both use SOCK_STREAM :>
> The TCP-Style interface (which is prefered here since apache expects the
> listen/accept model) uses the same type. The only difference is
> the protocol type (third argument to socket()). Now of course
> all socket calls in apache2 use a ,0); as the last arg.. this is
> a base problem. I think the right  fix is to add a protocol type
> and maintain this...

I'm sorry, I wasn't clear.  Because the server only opens the listening
socket in one place, the easiest way to do this, is to completely ignore
Apache.  Just write a module that opens the SCTP socket, and add it to the
listen_rec list.  From that point on, whenever Apache receives a request
over an SCTP socket, it will just use it.

A more long-term approach, is to integrate SCTP into APR, but I don't
really know how prevalent SCTP is.  If it only works on a small set of
platforms, then we are less likely to integrate it into APR, because by
it's very definition, it isn't portable.  There is also the problem that
the only source I have found for SCTP is under the GPL.

> I am getting there.. but I still have a problem.. and this may
> be a config issue.. drats that I did not compile it unchanged first :-0
> I suppose I will have to go re-download a clean copy..
> I get everything working.. the TCP and SCTP sockets open up to
> listen for HTTP requests.. but then somewhere along the line
> the server does its exit.. I guess after forking its children.. but
> at that point the SCTP socket closes.. so do the TCP ones as well :-0
> Thus I suspect a problem in my config...

This doesn't sound like a config problem.  The Apache parent process
starts, and then forks to make itself a daemon.  The forked process then
reads the config, and sets itself and the children up.  That first child
should never die, and that is where the socket is opened.  It sounds like
there is some other problem here.


Ryan Bloom               
550 Jean St
Oakland CA 94610

View raw message