-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Wrap getaddrinfo to try more than once on Windows. #1346
Open
madbrain76
wants to merge
2
commits into
esnet:master
Choose a base branch
from
madbrain76:patch_branch
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Error should be either printer only if debug option was set or using
iperf_err()
(to properly handle the JSON output case). Suggest to leave the decision to the iperf3 maintainers (before merging the change).In both cases,
test
should be passed as a parameter to the function andiperf.h
should be included. In caseiperf_err
is used, alsoiperf_api.h
should be includedIf printed as debug message, suggest to use the newly added debug level option:
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.
David, thanks for the feedback. Obviously, I wrote my PR before the option was added. I would prefer for this message to be printed unconditionally if getaddrinfo fails intermittently, regardless of the new debug option. The rationale is that with the loop in place, a fatal error would not be seen anymore. And without being aware of the intermittent failure behind the scene, nobody would think to add -d. The intermittent failure seems rare enough that I wanted anyone with a affected system to see the message. Requiring -d would significantly decrease the odds anyone would ever know about the problem. The wording of the message could be changed, though.
I checked the source to see where debug_level was being set. The iperf_test structure that contains debug_level isn't available in the scope of most of the calls to getaddrinfo . A pointer to it would need to be propagated across the stack. getaddrinfo itself of course, being a low-level call, doesn't take this object as an argument. I am reluctant to change the prototype for getaddrinfo . I could make it a wrapper on all platforms, instead of having the platform #ifdef, though.
iperf_test appears to contain a global configuration state. And there is only ever a single instance, created in main() with a call to iperf_new_test. As long as that remains the case, it strikes me as a bit of busy work to pass this object around the stack down everywhere, not just to iperf_getaddrinfo. I don't want to address that in this PR.
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.
The new debug option is just the ability to set a debug level. Using
if (test->debug)
always existed, but it still needs the use ofiperf_test
.I agree. In this case still
iperf_err()
should be used to log the error, to properly handle JSON output (in case-J
was set), which also needs the use ofiperf_test
.I agree that adding
iperf_test
togetaddrinfo
and to net.c in general is a problem. I therefore suggest to leave the decision to the iperf3 maintainers whether to propagateiperf_test
down to net.c, not log the error ingetaddrinfo
, add a wrapper or any of the other approaches you suggested.