mirror of
https://github.com/golang/go
synced 2024-11-20 03:44:40 -07:00
net: change windows netFD finalizer to behave similar to unix
R=dave, mikioh.mikioh CC=golang-dev https://golang.org/cl/6873046
This commit is contained in:
parent
a7c57b05e9
commit
4855c1c145
@ -300,7 +300,6 @@ func allocFD(fd syscall.Handle, family, sotype int, net string) *netFD {
|
||||
net: net,
|
||||
closec: make(chan bool),
|
||||
}
|
||||
runtime.SetFinalizer(netfd, (*netFD).Close)
|
||||
return netfd
|
||||
}
|
||||
|
||||
@ -319,6 +318,7 @@ func newFD(fd syscall.Handle, family, proto int, net string) (*netFD, error) {
|
||||
func (fd *netFD) setAddr(laddr, raddr Addr) {
|
||||
fd.laddr = laddr
|
||||
fd.raddr = raddr
|
||||
runtime.SetFinalizer(fd, (*netFD).closesocket)
|
||||
}
|
||||
|
||||
func (fd *netFD) connect(ra syscall.Sockaddr) error {
|
||||
@ -398,6 +398,10 @@ func (fd *netFD) CloseWrite() error {
|
||||
return fd.shutdown(syscall.SHUT_WR)
|
||||
}
|
||||
|
||||
func (fd *netFD) closesocket() error {
|
||||
return closesocket(fd.sysfd)
|
||||
}
|
||||
|
||||
// Read from network.
|
||||
|
||||
type readOp struct {
|
||||
|
Loading…
Reference in New Issue
Block a user