Since I'm configuring my xinetd service with "wait=no" xinetd accepts the connection and dup's the socket fd to my go processes stdin. I'd like to see a http.ServeConn function that takes a net.Conn argument. I can create a Conn using FileConn(os.Stdin) but I don't see anyway to use that connection to create a http server does anyone know how to do this? Maybe I could use ServerConn somehow?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Giulio, net.FileConn(os.Stdin) already gives Ted the net.Conn he needs. It's the stubbed listener that's required.
Yes, and I don't think xinetd could split the read and write sides of the socket into different file descriptors even if it wanted to.
Yes, and I don't think xinetd could split the read and write sides of the socket into different file descriptors even if it wanted to.
On Thu, Sep 17, 2015, 15:02 Ian Lance Taylor <ia...@golang.org> wrote:It can't. But we're talking about invoking the program via xinetd
here, and xinetd will pass the same connection as file descriptors 0,
1, and 2.
The basic strategy worked but then I encountered the issue of shutting down the http server since this is a REST Api and it only processes one request per xinetd invocation. As a hack after I write the response I flush the writer close the connection and exit ... maybe there's a better way to do this?