Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function Serve()'s param #23

Open
scp1513 opened this issue Jan 9, 2016 · 0 comments
Open

function Serve()'s param #23

scp1513 opened this issue Jan 9, 2016 · 0 comments

Comments

@scp1513
Copy link

scp1513 commented Jan 9, 2016

I want to use LimitListener from "golang.org/x/net/netutil" for the Serve() function, but there is no way to do that. Normally, the Serve() function has a listener param.

...
l, err := net.Listen("tcp", addr)
if err != nil {
    return
}

l = netutil.LimitListener(TcpKeepAliveListener(l), MAX_CONN_NUM)
server := &http.Server{Addr: addr, Handler: handler}
err = server.Serve(l)

Maybe we can use like this:

...
l, err := net.Listen("tcp", addr)
if err != nil {
    return
}

l = netutil.LimitListener(TcpKeepAliveListener(l), MAX_CONN_NUM)
//server := &http.Server{Addr: addr, Handler: handler}
server := endless.NewServer(addr, handler)
err = server.Serve(l)

Sorry for my broken English.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant