net: avoid Shutdown during Close
Once we've evicted all the blocked I/O, the ref count
should go to zero quickly, so it should be safe to
postpone the close(2) until then.
Fixes #1898.
Fixes #2116.
Fixes #2122.
R=golang-dev, mikioh.mikioh, bradfitz, fullung, iant
CC=golang-dev
https://golang.org/cl/5649076
diff --git a/src/pkg/net/sendfile_windows.go b/src/pkg/net/sendfile_windows.go
index c247477..6f9b4a0 100644
--- a/src/pkg/net/sendfile_windows.go
+++ b/src/pkg/net/sendfile_windows.go
@@ -50,7 +50,9 @@
c.wio.Lock()
defer c.wio.Unlock()
- c.incref()
+ if err := c.incref(); err != nil {
+ return 0, err, true
+ }
defer c.decref()
var o sendfileOp