Documentation
¶
Overview ¶
Package httpadmission counts the requests an HTTP handler has admitted and not yet returned from, so a server's stop can wait for them after a forced close.
net/http stops tracking a handler once its connection is closed: after http.Server.Close, a later Shutdown returns nil at once while the handler still runs (setup-04a-03-boot-service-manager design D2, probe C3 on #353). A server that must not report itself stopped while a handler runs wraps its handler with Requests.Wrap, closes admission when its stop begins, and waits with Requests.Wait. metric.Server and the service manager's listeners use it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Requests ¶
type Requests struct {
// contains filtered or unexported fields
}
Requests counts admitted requests. Closing admission first means that once it is closed and nothing runs, which Wait observes under the same lock, no request can start. The zero value is ready to use; a Requests must not be copied after first use.
func (*Requests) CloseAdmission ¶
func (r *Requests) CloseAdmission()
CloseAdmission refuses every later request; requests already admitted run on.