package net
import (
- "errors"
"io"
"os"
"runtime"
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.
}
// 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
}
// 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 {
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.