summaryrefslogtreecommitdiff
path: root/src/net/file_unix.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-02-10 14:59:38 -0800
committerIan Lance Taylor <iant@golang.org>2017-02-13 18:36:28 +0000
commit3792db518327c685da17ca6c6faa4e1d2da4c33c (patch)
tree8d2456fa679526c8349a968aaf3cae09524aadfd /src/net/file_unix.go
parentb548eee3d96fc0b6e962a243b28121e1f37ad792 (diff)
downloadgo-git-3792db518327c685da17ca6c6faa4e1d2da4c33c.tar.gz
net: refactor poller into new internal/poll package
This will make it possible to use the poller with the os package. This is a lot of code movement but the behavior is intended to be unchanged. Update #6817. Update #7903. Update #15021. Update #18507. Change-Id: I1413685928017c32df5654ded73a2643820977ae Reviewed-on: https://go-review.googlesource.com/36799 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/net/file_unix.go')
-rw-r--r--src/net/file_unix.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/net/file_unix.go b/src/net/file_unix.go
index 9e581fcb41..d67dff8e05 100644
--- a/src/net/file_unix.go
+++ b/src/net/file_unix.go
@@ -7,6 +7,7 @@
package net
import (
+ "internal/poll"
"os"
"syscall"
)
@@ -17,7 +18,7 @@ func dupSocket(f *os.File) (int, error) {
return -1, err
}
if err := syscall.SetNonblock(s, true); err != nil {
- closeFunc(s)
+ poll.CloseFunc(s)
return -1, os.NewSyscallError("setnonblock", err)
}
return s, nil
@@ -31,7 +32,7 @@ func newFileFD(f *os.File) (*netFD, error) {
family := syscall.AF_UNSPEC
sotype, err := syscall.GetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_TYPE)
if err != nil {
- closeFunc(s)
+ poll.CloseFunc(s)
return nil, os.NewSyscallError("getsockopt", err)
}
lsa, _ := syscall.Getsockname(s)
@@ -44,12 +45,12 @@ func newFileFD(f *os.File) (*netFD, error) {
case *syscall.SockaddrUnix:
family = syscall.AF_UNIX
default:
- closeFunc(s)
+ poll.CloseFunc(s)
return nil, syscall.EPROTONOSUPPORT
}
fd, err := newFD(s, family, sotype, "")
if err != nil {
- closeFunc(s)
+ poll.CloseFunc(s)
return nil, err
}
laddr := fd.addrFunc()(lsa)