Skip to content

Return port number or zero otherwise in forward command - #457

Closed
yotamN wants to merge 1 commit into
DeviceFarmer:masterfrom
yotamN:feature/forward-port-value
Closed

yotamN wants to merge 1 commit into
DeviceFarmer:masterfrom
yotamN:feature/forward-port-value

Conversation

@yotamN

@yotamN yotamN commented Jun 11, 2023 •

Copy link
Copy Markdown

Fixes #456

@koral--

koral-- commented Jun 12, 2023

Copy link
Copy Markdown
Member

Your PR does not pass the checks.

@denis99999

Copy link
Copy Markdown

It should not break backward compatibility

@yotamN

yotamN commented Jun 12, 2023

Copy link
Copy Markdown
Author

I will make sure it passes the tests but regarding backward compatibility, I'm not sure how you want me to do it.
I must change the return value, so my options are:

  • Create a new function and deprecate the old one, how would I call it?
  • Keep returning null unless there's a port and than return the port (which is truthful)
  • Extend the boolean object with getPort or something, the most awful solution IMO.

@koral--

koral-- commented Oct 30, 2026

Copy link
Copy Markdown
Member

Thank you for this, and sorry for the long wait. Changing forward() to return the port would have broken the 4.x API, so #574 reimplements it additively. forward() still returns true, and the new DeviceClient.forwardTcp(local, remote) resolves to the port. It also reads adb's port reply, which used to leak a socket on every call. You're credited as co-author. It's merged and will ship in the next adbkit release. Closing in favour of #574.

@koral-- koral-- closed this Oct 30, 2026
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.

Forward command doesn't return the resolved tcp port

4 participants