dutil

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PanicToError = derror.PanicToError

PanicToError is a legacy alias for derror.PanicToError.

Note: We use a variable here (instead of wrapping the function) in order to avoid adding an extra entry to the stacktrace.

Functions

func ListenAndServeHTTPSWithContext

func ListenAndServeHTTPSWithContext(ctx context.Context, server *http.Server, certFile, keyFile string) error

ListenAndServeHTTPSWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.

ListenAndServeHTTPSWithContext runs server.ListenAndServeTLS() on an http.Server, but properly calls server.Shutdown when the Context is canceled.

It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.

It is invalid to call ListenAndServeHTTPSWithContext with server.BaseContext set; the passed-in Context is the base Context.

func ListenAndServeHTTPWithContext

func ListenAndServeHTTPWithContext(ctx context.Context, server *http.Server) error

ListenAndServeHTTPWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.

ListenAndServeHTTPWithContext runs server.ListenAndServe() on an http.Server, but properly calls server.Shutdown when the Context is canceled.

It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.

It is invalid to call ListenAndServeHTTPWithContext with server.BaseContext set; the passed-in Context is the base Context.

func ServeHTTPSWithContext

func ServeHTTPSWithContext(ctx context.Context, server *http.Server, ln net.Listener, certFile, keyFile string) error

ServeHTTPSWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.

ServeHTTPSWithContext runs server.ServeTLS() on an http.Server, but properly calls server.Shutdown when the Context is canceled.

It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.

It is invalid to call ServeHTTPSWithContext with server.BaseContext set; the passed-in Context is the base Context.

ServeHTTPSWithContext always closes the Listener before returning (this is slightly different than *http.Server.ServeTLS, which does not close the Listener if returning early during setup due to being passed invalid cert or key files).

func ServeHTTPWithContext

func ServeHTTPWithContext(ctx context.Context, server *http.Server, ln net.Listener) error

ServeHTTPWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.

ServeHTTPWithContext(ln) runs server.Serve(ln) on an http.Server, but properly calls server.Shutdown when the Context is canceled.

It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.

It is invalid to call ServeHTTPWithContext with server.BaseContext set; the passed-in Context is the base Context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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