Skip to content

Commit

Permalink
net: document that File reverts connection to blocking mode.
Browse files Browse the repository at this point in the history
Fixes golang#2458.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/6869054
  • Loading branch information
rickar authored and rsc committed Dec 6, 2012
1 parent 82f2b36 commit 5416e6e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pkg/net/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,13 @@ func (c *conn) SetWriteBuffer(bytes int) error {
return setWriteBuffer(c.fd, bytes)
}

// File returns a copy of the underlying os.File, set to blocking mode.
// File sets the underlying os.File to blocking mode and returns a copy.
// It is the caller's responsibility to close f when finished.
// Closing c does not affect f, and closing f does not affect c.
//
// The returned os.File's file descriptor is different from the connection's.
// Attempting to change properties of the original using this duplicate
// may or may not have the desired effect.
func (c *conn) File() (f *os.File, err error) { return c.fd.dup() }

// An Error represents a network error.
Expand Down

0 comments on commit 5416e6e

Please sign in to comment.