stall

package
v0.1.4367 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stall ends a download that stops sending, and never one that is still moving, however slowly. A wall-clock cap on a whole download failed a slow link part way while its bytes were still coming (#5572: the 83 MB Windows update under ~140 KB/s against 10 minutes).

Index

Constants

This section is empty.

Variables

View Source
var ErrStalled = errors.New("no data came for a while")

ErrStalled is a download that got no byte for its Watch's while.

Functions

This section is empty.

Types

type Watch

type Watch struct {
	// contains filtered or unexported fields
}

Watch is one download's idle timer.

func Start

func Start(ctx context.Context, after time.Duration) (context.Context, *Watch)

Start returns a ctx under ctx that ends, its cause ErrStalled, once after goes by with no byte read through w.Reader. The timer runs from now: a server that never answers ends the same way. Stop it when the download is over.

func (*Watch) Err

func (w *Watch) Err(err error) error

Err is err, said as a stall (wrapping ErrStalled) when the watch is what ended the download.

func (*Watch) Reader

func (w *Watch) Reader(r io.Reader) io.Reader

Reader is r, each byte read from it putting the stall off again.

func (*Watch) Stop

func (w *Watch) Stop()

Stop ends the watch and the ctx Start gave.

Jump to

Keyboard shortcuts

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