2019-11-11 10:37:46 +00:00
|
|
|
// +build darwin linux
|
|
|
|
|
2016-06-01 04:07:09 +00:00
|
|
|
package tcp
|
|
|
|
|
2016-06-01 09:45:24 +00:00
|
|
|
import (
|
|
|
|
"errors"
|
2019-11-10 11:42:55 +00:00
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
2016-06-01 09:45:24 +00:00
|
|
|
)
|
|
|
|
|
2016-06-01 04:07:09 +00:00
|
|
|
// ErrTimeout indicates I/O timeout
|
|
|
|
var ErrTimeout = &timeoutError{}
|
|
|
|
|
|
|
|
type timeoutError struct{}
|
|
|
|
|
|
|
|
func (e *timeoutError) Error() string { return "I/O timeout" }
|
|
|
|
func (e *timeoutError) Timeout() bool { return true }
|
|
|
|
func (e *timeoutError) Temporary() bool { return true }
|
2016-06-01 09:47:04 +00:00
|
|
|
|
|
|
|
// ErrConnect is an error occurs while connecting to the host
|
|
|
|
// To get the detail of underlying error, lookup ErrorCode() in 'man 2 connect'
|
|
|
|
type ErrConnect struct {
|
2016-10-18 13:00:00 +00:00
|
|
|
error
|
2016-06-01 09:47:04 +00:00
|
|
|
}
|
|
|
|
|
2016-07-22 11:31:45 +00:00
|
|
|
// newErrConnect returns a ErrConnect with given error code
|
2016-06-01 09:47:04 +00:00
|
|
|
func newErrConnect(errCode int) *ErrConnect {
|
2019-11-10 11:42:55 +00:00
|
|
|
return &ErrConnect{unix.Errno(errCode)}
|
2016-06-01 09:47:04 +00:00
|
|
|
}
|
2019-01-31 07:27:44 +00:00
|
|
|
|
|
|
|
// ErrCheckerAlreadyStarted indicates there is another instance of CheckingLoop running.
|
|
|
|
var ErrCheckerAlreadyStarted = errors.New("Checker was already started")
|