Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
jemoreira
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
The return err changes do not apply, but the defer l.Close() does. In addition to fixing the PR you need to sign the Google CLA before we can merge your change, follow the instructions from the google-cla bot.
| // Ask ADB server to connect even if the connection to the device already exists. | ||
| if err := opts.ADBServerProxy.Connect(ret.Status.ADB.Port); err != nil { | ||
| c.PrintErrf("Failed to connect ADB to device %q: %v\n", device, err) | ||
| return err |
There was a problem hiding this comment.
The main purpose of the function is to keep a port open that exposes the device's adb daemon in this host. This particular code instructs the adb server in this host to connect to that port. That may fail for several reasons, the most common one being no adb server is currently running; but none of those failures interferes with the main purpose of the function so the error is only logged.
| err = opts.ADBServerProxy.Connect(adbPort) | ||
| if err != nil { | ||
| c.PrintErrf("Failed to connect ADB to device: %v\n", err) | ||
| return err |
There was a problem hiding this comment.
same as before, this is not fatal.
Thanks for this great project.
While exploring codebase, I found some suspicious behaviors related to err handling and resource closing , therefore I opened PR.
First issue related to err handling @ runConnectionWebSocketAgentCommand & runConnectionWebrtcAgentCommand
I think code below do not exit when adb connect is failed.
Should we
return errwhen adb connect failed? or is this intended ?Second issue related to resource closing @ runConnectionWebSocketAgentCommand
I think code below do not close the
net.Listenresource.Should we add
defer l.Close()?Thank you for taking time for reading my small fix.