1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:14:49 -07:00

net: add missing locking in windows Shutdown

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6811069
This commit is contained in:
Alex Brainman 2012-11-02 20:46:47 +11:00
parent 0b2353edcb
commit 90d959be78

View File

@ -371,9 +371,10 @@ func (fd *netFD) Close() error {
}
func (fd *netFD) shutdown(how int) error {
if fd == nil || fd.sysfd == syscall.InvalidHandle {
return syscall.EINVAL
if err := fd.incref(false); err != nil {
return err
}
defer fd.decref()
err := syscall.Shutdown(fd.sysfd, how)
if err != nil {
return &OpError{"shutdown", fd.net, fd.laddr, err}