aboutsummaryrefslogtreecommitdiff
path: root/src/net/net.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/net.go')
-rw-r--r--src/net/net.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/net/net.go b/src/net/net.go
index 2e61a7c02e..4b4ed129cc 100644
--- a/src/net/net.go
+++ b/src/net/net.go
@@ -81,6 +81,7 @@ package net
import (
"context"
"errors"
+ "internal/poll"
"io"
"os"
"sync"
@@ -632,6 +633,17 @@ func (e *DNSError) Timeout() bool { return e.IsTimeout }
// error and return a DNSError for which Temporary returns false.
func (e *DNSError) Temporary() bool { return e.IsTimeout || e.IsTemporary }
+// errClosed exists just so that the docs for ErrClosed don't mention
+// the internal package poll.
+var errClosed = poll.ErrNetClosing
+
+// ErrClosed is the error returned by an I/O call on a network
+// connection that has already been closed, or that is closed by
+// another goroutine before the I/O is completed. This may be wrapped
+// in another error, and should normally be tested using
+// errors.Is(err, net.ErrClosed).
+var ErrClosed = errClosed
+
type writerOnly struct {
io.Writer
}