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

connect: remove superfluous conditional #7511

Closed

Conversation

@danielgustafsson
Copy link
Member

@danielgustafsson danielgustafsson commented Jul 28, 2021

Commit dbd16c3 cleaned up the logic for traversing the addrinfos,
but the move left a conditional on ai which no longer is needed as
the while loop reevaluation will cover it.

Closes #xxxx

Commit dbd16c3 cleaned up the logic for traversing the addrinfos,
but the move left a conditional on ai which no longer is needed as
the while loop reevaluation will cover it.

Closes #xxxx
result = singleipconnect(data, conn, ai, tempindex);
if(result == CURLE_COULDNT_CONNECT) {
ai = ainext(conn, tempindex, TRUE);
continue;
Copy link
Contributor

@carenas carenas Jul 29, 2021

continue and break could be removed by adding "&& result == CURLE_COULDNT_CONNECT" to the while loop condition

Copy link
Member Author

@danielgustafsson danielgustafsson Jul 29, 2021

It could, but it would have to be a do .. while loop instead as you'd otherwise inspect result before it's been set by the logic in question. Not sure that improves readability.

Copy link
Contributor

@carenas carenas Jul 29, 2021

result is already initialized to the right value in line 579, so there is no need to change the loop AFAIK and IMHO makes the code more readable by meaning: "while there are still addresses to check and we hadn't be able to connect do ..."

@danielgustafsson
Copy link
Member Author

@danielgustafsson danielgustafsson commented Jul 29, 2021

bagder
bagder approved these changes Jul 29, 2021
Copy link
Member

@bagder bagder left a comment

👍 on the submitted suggestion. Not convinced about the suggested further cleanup, but shown the suggestion as a PR I might change my mind.

@danielgustafsson
Copy link
Member Author

@danielgustafsson danielgustafsson commented Jul 30, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants