httpshutdown

package module
v0.0.0-...-1cecf45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2015 License: BSD-3-Clause Imports: 3 Imported by: 0

README

package httpshutdown
    import "github.com/kr/httpshutdown"

    Package httpshutdown illustrates a possible way to do graceful shutdown
    with net/http. This code is untested.


TYPES

type Server struct {
    Server *http.Server
    // contains filtered or unexported fields
}
    Serve wraps the net/http Server and performs graceful shutdown.


func (s *Server) Serve(l net.Listener) error
    Serve calls Serve on the underlying http Server, but wraps l in another
    net.Listener that synchronises open connections with Wait.

func (s *Server) Wait()
    Wait waits for all open connections in s to close.



Documentation

Overview

Package httpshutdown illustrates a possible way to do graceful shutdown with net/http. This code is untested.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Server http.Server
	// contains filtered or unexported fields
}

Serve wraps the net/http Server and performs graceful shutdown.

func (*Server) Serve

func (s *Server) Serve(l net.Listener) error

Serve calls Serve on the underlying http Server, but wraps l in another net.Listener that synchronises open connections with Wait.

func (*Server) Wait

func (s *Server) Wait()

Wait waits for all open connections in s to close.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL