Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ func runConnectionWebrtcAgentCommand(flags *ConnectFlags, c *command, args []str
// 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
Copy link
Member

Choose a reason for hiding this comment

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

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.

}

if ret.Controller == nil {
Expand Down Expand Up @@ -1338,11 +1339,13 @@ func runConnectionWebSocketAgentCommand(flags *ConnectFlags, c *command, args []
c.PrintErrf("Failed to listen ADB socket: %v", err)
return err
}
defer l.Close()
device := args[0]
adbPort := l.Addr().(*net.TCPAddr).Port
err = opts.ADBServerProxy.Connect(adbPort)
if err != nil {
c.PrintErrf("Failed to connect ADB to device: %v\n", err)
return err
Copy link
Member

Choose a reason for hiding this comment

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

same as before, this is not fatal.

}

for {
Expand Down