-
Notifications
You must be signed in to change notification settings - Fork 1.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
Use timeout for chooseProtocol #458
Conversation
Could you use one of the Resolver methods that take a context? |
That's what I initially looked into doing, but couldn't find a Resolver function that supported both protocol, and context. LookupIPAddr doesn't take the protocol, but will return ipv4 and ipv6, which changes the behavior of the chooseProtocol function some. And there's currently |
We could filter the result of LookupIPAddr. |
If that's an acceptable change I'd be happy to make that. |
I've made the changes to use LookupIPAddr and return the requested IP protocol, or fallback if necessary. |
Is travis-ci a flake? Unable to get failures locally |
Doesn't appear to be a flake. I wonder if LookupIPAddr wont work since this technically changes the underlying behavior and does an ipv6 lookup too? |
Failure seems to be unique to Travis. I'm unable to get it to fail on the other platforms I've tried |
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.
I've had that in the past, it was a v6 issue iirc.
2735fe8
to
9062fdd
Compare
Signed-off-by: Thor <[email protected]>
Since Travis doesn't support v6 and it's technically changing the behavior of the code to use the LookupIPAddr I've reverted it to the wrapped ctx method. Hopefully in the future the net package will become more mature and make this easier. |
The problem with that though is that we don't actually stop the request. I'd prefer the LookupIPAddr method, and then do whatever to get Travis to pass. |
Signed-off-by: Thor <[email protected]>
Signed-off-by: Thor <[email protected]>
Lookup ip addr
Signed-off-by: Thor <[email protected]>
Okay, I moved it back to use LookupIPAddr, and skipped the 4 failing tests on the travis environment |
Thanks! |
If an address DNS resolve takes a while, a probe can easily exceed its timeout limit.
This threads the given context to the probe into the
chooseProtocol
func to exit lookup of the IP address upon timeout.