transportutil

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("transport already closed")

Functions

func BufferCommands

func BufferCommands(w io.Writer, maxCommandSize uint32) io.Writer

BufferCommands buffers command packets written to the returned writer and writes complete packets to the supplied writer in a single write. The maxCommandSize argument defines the maximum size of a command.

func BufferResponses

func BufferResponses(r io.Reader, maxResponseSize uint32) io.Reader

BufferResponses reads complete response packets from the supplied reader in a single read and makes them available to the returned reader for partial reading. The maxResponseSize argument defines the size of the read on the supplied reader.

func NewRetrierTransport

func NewRetrierTransport(transport tpm2.Transport, params RetryParams) tpm2.Transport

NewRetrierTransport returns a new transport that resubmits commands on certain errors, which is necessary for transports that don't already do this.

Types

type RetryParams

type RetryParams struct {
	// MaxRetries is the maximum number of times a command is retried.
	MaxRetries uint

	// InitialBackoff is the amount of time to wait before submitting the
	// first retry.
	InitialBackoff time.Duration

	// BackoffRate determines how much more time to wait before submitting
	// each subsequent retry. Eg, if InitialBackoff is 20ms and this field
	// is 2, the first retry will be attempted after a delay of 20ms, then
	// the next retry after 40ms, then 80ms etc.
	BackoffRate uint
}

Jump to

Keyboard shortcuts

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