-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add another error to the isConnRefused check #1951
Conversation
3db3a06
to
17bce50
Compare
@whyrusleeping can you separate the filepath out into another commit? two totally unrelated logical changes worth having separate to be able to revert one etc. |
return false | ||
} | ||
|
||
return netoperr.Op == "dial" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not sure this one statement captures the two other errors. also no longer works with a non-url net.OpError
. and if a dial fails for some other reason (like memory alloc failure or some other random happenstance) this will not discern (may be ok).
how about something like:
func isConnRefused(err error) bool {
switch e := err.(type) {
case *url.Error:
return isConnRefused(e.Err)
case *net.OpError:
return e.Op == "dial" && (further condition that e really means failure to connect here)
default:
return false
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're not going to get a netOp error from a call to http.Post
though. The net.OpError
is always wrapped before being returned down to us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then rename it isHTTPConnRefused(...)
if you dont want people to use it for other net conn error checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(id just support both probably)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR, but there are several strings.Contains
err checks elsewhere in the code that should be fixed.
yay for path stuff. some comments abvoe |
17bce50
to
d040664
Compare
commits split up |
@whyrusleeping https://travis-ci.org/ipfs/go-ipfs/jobs/90004675#L158 looks like a rebase problem |
(since it's on pr) |
LGTM otherwise, feel free to merge once that's fixed and all tests pass |
b3c1ffa
to
554f304
Compare
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com> rewrite path to filepath in fsrepo License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com> remove api file on repo close License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com> update function to check normal net.OpErrors License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
554f304
to
a23609f
Compare
add another error to the isConnRefused check
fixed, squashed, and going into master. |
fixes #1950 and also makes things more likely to work on windows (decided to fix the filepath stuff while i was at it)
License: MIT
Signed-off-by: Jeromy jeromyj@gmail.com