ctxconn

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ctxconn provides a helper function to track context cancellation when working with connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelFunc

type CancelFunc func()

CancelFunc can be used to shut down context watchers. It is safe to call the cancel function multiple times.

func CloseConnOnDone

func CloseConnOnDone(ctx context.Context, conn DeadlineCloser) CancelFunc

CloseConnOnDone closes conn whenever ctx is Done. This includes if ctx is canceled via its cancellation function.

Call the returned cancellation function to free up resources. Calling this function does not guarantee that the connection has been closed. It is not safe to call the returned function multiple times at the same time.

type DeadlineCloser

type DeadlineCloser interface {
	SetDeadline(t time.Time) error
	io.Closer
}

Directories

Path Synopsis
Package mock_ctxconn is a generated GoMock package.
Package mock_ctxconn is a generated GoMock package.

Jump to

Keyboard shortcuts

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