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

feat(android-setup): choose host port dynamically #2933

Merged
merged 9 commits into from
Jun 23, 2020

Conversation

dbjorge
Copy link
Contributor

@dbjorge dbjorge commented Jun 22, 2020

Description of changes

This PR uses the portfinder NPM package to have our service configurator dynamically choose a free host port to bind to, rather than unilaterally choosing the same port hardcoded into the service.

The logic to use portfinder is pretty straightforward; the more complicated change was the corresponding update to removeTcpForwarding. I didn't want to break the existing behavior of being able to clean up old forwarded ports from past app launches, so rather than updating it to accept a number parameter, it instead uses ADB getForwardList to query for all host ports that are mapped to the hardcoded service port, and removes the forwarding entry for each of those.

This change should be transparent to an end user except that it eliminates a class of errors that could occur from port reuse during setup; no visual change.

Pull request checklist

  • [n/a] Addresses an existing issue: #0000
  • Ran yarn fastpass
  • Added/updated relevant unit test(s) (and ran yarn test)
  • Verified code coverage for the changes made. Check coverage report at: <rootDir>/test-results/unit/coverage
  • PR title AND final merge commit title both start with a semantic tag (fix:, chore:, feat(feature-name):, refactor:). See CONTRIBUTING.md.
  • [n/a] (UI changes only) Added screenshots/GIFs to description above
  • [n/a] (UI changes only) Verified usability with NVDA/JAWS

@dbjorge dbjorge requested a review from a team as a code owner June 22, 2020 20:58
Copy link
Contributor

@DaveTryon DaveTryon left a comment

Choose a reason for hiding this comment

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

Very nice!

@dbjorge dbjorge merged commit 23db22f into microsoft:master Jun 23, 2020
@dbjorge dbjorge deleted the port-range branch June 23, 2020 18:12
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.

2 participants