ipcsock

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 4 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 ipcsock bounds a request on a local unix socket, so a hung peer costs its client an error instead of the client's thread.

Index

Constants

View Source
const Standard = Timeout(5 * time.Second)

Standard is what every client runs with.

Variables

This section is empty.

Functions

func Dial

func Dial(path string) (net.Conn, error)

Dial connects without waiting: a unix connect on Go's non-blocking socket either succeeds at once or fails at once with EAGAIN on a full backlog.

func Disarm

func Disarm(conn net.Conn) error

Disarm turns a connection that finished its handshake into a stream.

Types

type Session

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

Session is a connection kept for one request after another, replaced after a request that failed. The caller serializes requests; Close may come at any time.

func Connect

func Connect(path string, timeout Timeout) (*Session, error)

Connect opens a session, failing if the socket cannot be reached now.

func (*Session) Acquire

func (s *Session) Acquire() (net.Conn, bool, error)

Acquire is the connection armed for one request, and whether it is new since the last Acquire, in which case nothing buffered from the old one applies.

func (*Session) Close

func (s *Session) Close() error

Close ends the session and any request on it.

func (*Session) Drop

func (s *Session) Drop(conn net.Conn)

Drop retires the connection of a request that failed.

type Timeout

type Timeout time.Duration

Timeout is how long one request may take to write and read.

func (Timeout) Arm

func (t Timeout) Arm(conn net.Conn) error

Arm gives conn one request's time from now, for writing and reading.

func (Timeout) ArmRead

func (t Timeout) ArmRead(conn net.Conn) error

ArmRead is ArmWrite's other half.

func (Timeout) ArmWrite

func (t Timeout) ArmWrite(conn net.Conn) error

ArmWrite is Arm for a connection whose reads have a life of their own.

func (Timeout) Open

func (t Timeout) Open(path string) (net.Conn, error)

Open connects and arms the connection for one request.

func (Timeout) Stream

func (t Timeout) Stream(path string, request []byte) (net.Conn, error)

Stream connects, writes request under the deadline, and hands back a connection that may stay silent for as long as nothing happens.

Directories

Path Synopsis
Package ipcsocktest fakes a hung compositor on a unix socket.
Package ipcsocktest fakes a hung compositor on a unix socket.

Jump to

Keyboard shortcuts

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