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

Commit 6ebe3f5

Browse files
authored
Merge pull request #18 from libp2p/fix/13
Document Reset versus Close
2 parents a0904d8 + a53a510 commit 6ebe3f5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

muxer.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@ import (
66
"time"
77
)
88

9-
// Stream is a bidirectional io pipe within a connection
9+
// Stream is a bidirectional io pipe within a connection.
1010
type Stream interface {
1111
io.Reader
1212
io.Writer
13+
14+
// Close closes the stream for writing. Reading will still work (that
15+
// is, the remote side can still write).
1316
io.Closer
1417

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

1722
SetDeadline(time.Time) error
1823
SetReadDeadline(time.Time) error
1924
SetWriteDeadline(time.Time) error
2025
}
2126

22-
// NoOpHandler do nothing. close streams as soon as they are opened.
23-
var NoOpHandler = func(s Stream) { s.Close() }
27+
// NoOpHandler do nothing. Resets streams as soon as they are opened.
28+
var NoOpHandler = func(s Stream) { s.Reset() }
2429

2530
// Conn is a stream-multiplexing connection to a remote peer.
2631
type Conn interface {

0 commit comments

Comments
 (0)