mirror of https://github.com/golang/go.git
net: use better error messages on windows
Fixes #4320. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6810064
This commit is contained in:
parent
048323aa12
commit
84e20465fc
|
|
@ -7,7 +7,6 @@
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
@ -346,8 +345,6 @@ func (fd *netFD) connect(ra syscall.Sockaddr) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var errClosing = errors.New("use of closed network connection")
|
|
||||||
|
|
||||||
// Add a reference to this fd.
|
// Add a reference to this fd.
|
||||||
// If closing==true, pollserver must be locked; mark the fd as closing.
|
// If closing==true, pollserver must be locked; mark the fd as closing.
|
||||||
// Returns an error if the fd cannot be used.
|
// 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.
|
// Wait for our request to complete.
|
||||||
var r ioResult
|
var r ioResult
|
||||||
var cancelled bool
|
var cancelled, timeout bool
|
||||||
select {
|
select {
|
||||||
case r = <-o.resultc:
|
case r = <-o.resultc:
|
||||||
case <-timer:
|
case <-timer:
|
||||||
cancelled = true
|
cancelled = true
|
||||||
|
timeout = true
|
||||||
case <-o.fd.closec:
|
case <-o.fd.closec:
|
||||||
cancelled = true
|
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.
|
// Wait for IO to be canceled or complete successfully.
|
||||||
r = <-o.resultc
|
r = <-o.resultc
|
||||||
if r.err == syscall.ERROR_OPERATION_ABORTED { // IO Canceled
|
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 {
|
if r.err != nil {
|
||||||
|
|
@ -312,8 +317,6 @@ func (fd *netFD) connect(ra syscall.Sockaddr) error {
|
||||||
return syscall.Connect(fd.sysfd, ra)
|
return syscall.Connect(fd.sysfd, ra)
|
||||||
}
|
}
|
||||||
|
|
||||||
var errClosing = errors.New("use of closed network connection")
|
|
||||||
|
|
||||||
// Add a reference to this fd.
|
// Add a reference to this fd.
|
||||||
// If closing==true, mark the fd as closing.
|
// If closing==true, mark the fd as closing.
|
||||||
// Returns an error if the fd cannot be used.
|
// 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 errTimeout error = &timeoutError{}
|
||||||
|
|
||||||
|
var errClosing = errors.New("use of closed network connection")
|
||||||
|
|
||||||
type AddrError struct {
|
type AddrError struct {
|
||||||
Err string
|
Err string
|
||||||
Addr string
|
Addr string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue