go: github.com/shurcooL/go/httpstoppable Index | Files

package httpstoppable

import "github.com/shurcooL/go/httpstoppable"

Package httpstoppable provides ListenAndServe like http.ListenAndServe, but with ability to stop it.

Deprecated: Go 1.8 adds native support for stopping a server in net/http. Once 1.8 is out, net/http should be used instead. This package will be removed shortly thereafter.

Index

Package Files

httpstoppable.go

func ListenAndServe Uses

func ListenAndServe(addr string, handler http.Handler, stop <-chan struct{}) error

ListenAndServe listens on the TCP network address addr and then calls Serve with handler to handle requests on incoming connections. Accepted connections are configured to enable TCP keep-alives. Handler is typically nil, in which case the http.DefaultServeMux is used.

When receiving from stop unblocks (because it's closed or a value is sent), listener is closed and ListenAndServe returns with nil error. Otherise, it always returns a non-nil error.

Package httpstoppable imports 5 packages (graph) and is imported by 4 packages. Updated 2017-02-20. Refresh now. Tools for package owners.