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

refactor(runtime): return iterator from resolve_addr #8891

Merged
merged 2 commits into from
Dec 30, 2020

Conversation

magurotuna
Copy link
Member

This PR does refactoring for runtime/resolve_addr.rs.
At first I did it in the other PR (#8790) but I have extracted it as a separate PR to allow #8790 to focus on Deno.resolveDns API.

The changes in this PR are:

  • to let resolve_addr and resolve_addr_sync return iterators of SocketAddr, not just a single SocketAddr. These functions previously called .next() on an iterator internally, and returned it, so the callers of these functions had no way of handling other items than the first item in the iterator. This change allows the caller to decide how to use the returned iterator.
  • to use generic_error in deno_core instead of anyhow::Context. When I worked on refactor(cli): add async version of resolve_addr function #8743, I didn't know there were utility error functions like generic_error.

See also #8790 (comment)

CC @bartlomieju

@bartlomieju
Copy link
Member

LGTM, I'll let @ry review before landing.

@bartlomieju bartlomieju requested a review from ry December 26, 2020 16:59
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @magurotuna

@ry ry merged commit 92a8205 into denoland:master Dec 30, 2020
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.

None yet

3 participants