Better logging for connection failures.

This commit is contained in:
Zach Klippenstein 2015-05-03 18:07:03 -07:00
parent cafabc99f6
commit 0be787db78
2 changed files with 5 additions and 1 deletions

View file

@ -147,7 +147,7 @@ func (c *DeviceClient) getAttribute(attr string) (string, error) {
func (c *DeviceClient) dialDevice() (*wire.Conn, error) {
conn, err := c.dialer.Dial()
if err != nil {
return nil, fmt.Errorf("error dialing adb server: %+v", err)
return nil, fmt.Errorf("error dialing adb server (%s): %+v", c.dialer, err)
}
req := fmt.Sprintf("host:%s", c.descriptor.getTransportDescriptor())

View file

@ -23,6 +23,10 @@ func NewDialer(host string, port int) Dialer {
return &netDialer{host, port}
}
func (d *netDialer) String() string {
return fmt.Sprintf("netDialer(%s:%d)", d.Host, d.Port)
}
// Dial connects to the adb server on the host and port set on the netDialer.
// The zero-value will connect to the default, localhost:5037.
func (d *netDialer) Dial() (*Conn, error) {