Commit 84e20465 authored by Alex Brainman's avatar Alex Brainman

net: use better error messages on windows

Fixes #4320.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6810064
parent 048323aa
......@@ -7,7 +7,6 @@
package net
import (
"errors"
"io"
"os"
"runtime"
......@@ -346,8 +345,6 @@ func (fd *netFD) connect(ra syscall.Sockaddr) error {
return err
}
var errClosing = errors.New("use of closed network connection")
// Add a reference to this fd.
// If closing==true, pollserver must be locked; mark the fd as closing.
// Returns an error if the fd cannot be used.
......
......@@ -196,11 +196,12 @@ func (s *ioSrv) ExecIO(oi anOpIface, deadline int64) (int, error) {
}
// Wait for our request to complete.
var r ioResult
var cancelled bool
var cancelled, timeout bool
select {
case r = <-o.resultc:
case <-timer:
cancelled = true
timeout = true
case <-o.fd.closec:
cancelled = true
}
......@@ -220,7 +221,11 @@ func (s *ioSrv) ExecIO(oi anOpIface, deadline int64) (int, error) {
// Wait for IO to be canceled or complete successfully.
r = <-o.resultc
if r.err == syscall.ERROR_OPERATION_ABORTED { // IO Canceled
r.err = syscall.EWOULDBLOCK
if timeout {
r.err = errTimeout
} else {
r.err = errClosing
}
}
}
if r.err != nil {
......@@ -312,8 +317,6 @@ func (fd *netFD) connect(ra syscall.Sockaddr) error {
return syscall.Connect(fd.sysfd, ra)
}
var errClosing = errors.New("use of closed network connection")
// Add a reference to this fd.
// If closing==true, mark the fd as closing.
// Returns an error if the fd cannot be used.
......
......@@ -221,6 +221,8 @@ func (e *timeoutError) Temporary() bool { return true }
var errTimeout error = &timeoutError{}
var errClosing = errors.New("use of closed network connection")
type AddrError struct {
Err string
Addr string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment