Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Document Reset versus Close #18

Merged
merged 2 commits into from
Sep 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions muxer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@ import (
"time"
)

// Stream is a bidirectional io pipe within a connection
// Stream is a bidirectional io pipe within a connection.
type Stream interface {
io.Reader
io.Writer

// Close closes the stream for writing. Reading will still work (that
// is, the remote side can still write).
io.Closer

// Reset closes both ends of the stream. Use this to tell the remote
// side to hang up and go away.
Reset() error

SetDeadline(time.Time) error
SetReadDeadline(time.Time) error
SetWriteDeadline(time.Time) error
}

// NoOpHandler do nothing. close streams as soon as they are opened.
var NoOpHandler = func(s Stream) { s.Close() }
// NoOpHandler do nothing. Resets streams as soon as they are opened.
var NoOpHandler = func(s Stream) { s.Reset() }

// Conn is a stream-multiplexing connection to a remote peer.
type Conn interface {
Expand Down