Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

add CloseRead/CloseWrite on streams #166

Merged
merged 2 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
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
56 changes: 0 additions & 56 deletions helpers/stream.go

This file was deleted.

151 changes: 0 additions & 151 deletions helpers/stream_test.go

This file was deleted.

24 changes: 22 additions & 2 deletions mux/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,30 @@ type MuxedStream interface {
io.Reader
io.Writer

// Close closes the stream for writing. Reading will still work (that
// is, the remote side can still write).
// Close closes the stream.
//
// * Any buffered data for writing will be flushed.
// * Future reads will fail.
// * Any in-progress reads/writes will be interrupted.
//
// Close may be asynchronous and _does not_ guarantee receipt of the
// data.
io.Closer

// CloseWrite closes the stream for writing but leaves it open for
// reading.
//
// CloseWrite does not free the stream, users must still call Close or
// Reset.
CloseWrite() error

// CloseRead closes the stream for writing but leaves it open for
// reading.
//
// CloseRead does not free the stream, users must still call Close or
// Reset.
CloseRead() error

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