mirror of
https://github.com/golang/go
synced 2024-11-05 18:36:08 +00:00
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
3 changed files with 9 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue