Skip to content
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

Merged
merged 1 commit into from
Nov 9, 2015

Conversation

whyrusleeping
Copy link
Member

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

@jbenet jbenet added the status/in-progress In progress label Nov 8, 2015
@whyrusleeping whyrusleeping force-pushed the fix/api-check-timeout branch 2 times, most recently from 3db3a06 to 17bce50 Compare November 8, 2015 05:08
@jbenet
Copy link
Member

jbenet commented Nov 8, 2015

@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"
Copy link
Member

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
  }
}

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member

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)

Copy link
Contributor

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.

@jbenet
Copy link
Member

jbenet commented Nov 8, 2015

yay for path stuff. some comments abvoe

@whyrusleeping
Copy link
Member Author

commits split up

@jbenet
Copy link
Member

jbenet commented Nov 8, 2015

@whyrusleeping https://travis-ci.org/ipfs/go-ipfs/jobs/90004675#L158 looks like a rebase problem

@jbenet
Copy link
Member

jbenet commented Nov 8, 2015

(since it's on pr)

@jbenet
Copy link
Member

jbenet commented Nov 8, 2015

LGTM otherwise, feel free to merge once that's fixed and all tests pass

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>
whyrusleeping added a commit that referenced this pull request Nov 9, 2015
add another error to the isConnRefused check
@whyrusleeping whyrusleeping merged commit 6ad200e into master Nov 9, 2015
@jbenet jbenet removed the status/in-progress In progress label Nov 9, 2015
@whyrusleeping
Copy link
Member Author

fixed, squashed, and going into master.

@whyrusleeping whyrusleeping deleted the fix/api-check-timeout branch November 9, 2015 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[0.3.9] ipfs daemon times out on second start
3 participants