make CancelWrite a no-op when called after closing the stream

This commit is contained in:
Marten Seemann
2019-01-24 09:22:46 +07:00
parent 415f79f892
commit 3808191679
3 changed files with 11 additions and 18 deletions

View File

@@ -50,9 +50,9 @@ type Stream interface {
// It must not be called after calling CancelWrite.
io.Closer
// CancelWrite aborts sending on this stream.
// It must not be called after Close.
// Data already written, but not yet delivered to the peer is not guaranteed to be delivered reliably.
// Write will unblock immediately, and future calls to Write will fail.
// When called multiple times or after closing the stream it is a no-op.
CancelWrite(ErrorCode) error
// CancelRead aborts receiving on this stream.
// It will ask the peer to stop transmitting stream data.