]> Cypherpunks repositories - gostls13.git/commitdiff
net: add File method to IPConn
authorMikio Hara <mikioh.mikioh@gmail.com>
Fri, 7 Oct 2011 13:53:12 +0000 (22:53 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Fri, 7 Oct 2011 13:53:12 +0000 (22:53 +0900)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5237041

src/pkg/net/iprawsock_posix.go

index 35aceb2233449ed2e6e73dfc9333877ba72ce167..f9e497f173e426a24d20532a8199e5890a4d4139 100644 (file)
@@ -305,3 +305,8 @@ func (c *IPConn) BindToDevice(device string) os.Error {
        defer c.fd.decref()
        return os.NewSyscallError("setsockopt", syscall.BindToDevice(c.fd.sysfd, device))
 }
+
+// File returns a copy of the underlying os.File, set to blocking mode.
+// It is the caller's responsibility to close f when finished.
+// Closing c does not affect f, and closing f does not affect c.
+func (c *IPConn) File() (f *os.File, err os.Error) { return c.fd.dup() }