Search code examples
goconnection-poolinghttpserver

Go: http.Server connection pool


I know http.Client in Go language has connection pool in type Transport

But there is no Transport in http.Server

I wish to access server's pool.

  1. List all connections
  2. Close connections/remove them from pool

Update

I am learning Go source code https://code.google.com/p/go/source/browse/src/pkg/net/http/server.go#1087

It seems that this function has the answer that there is no Pool.

May be someone knows how to override that function? Do I have to create a hole copy of package?


Solution

  • I got answer on go-nuts mailing list.

    https://groups.google.com/forum/#!topic/golang-nuts/eoBsx0Sl3Co

    1. Transport is not available in server (only in client)
    2. I can pass my own net.Listener
    3. LimitListener is one of such implementations. https://code.google.com/p/go/source/browse/netutil/listen.go?repo=net