mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-09 01:17:30 +08:00
refactor: replace gadb with optimized version authoried by @appl3s
This commit is contained in:
@@ -34,9 +34,18 @@ func newTransport(address string, readTimeout ...time.Duration) (tp transport, e
|
||||
|
||||
func (t transport) Send(command string) (err error) {
|
||||
msg := fmt.Sprintf("%04x%s", len(command), command)
|
||||
log.Debug().Str("cmd", command).Msg("run adb command")
|
||||
return _send(t.sock, []byte(msg))
|
||||
}
|
||||
|
||||
func (t transport) SendBytes(b []byte) (err error) {
|
||||
return _send(t.sock, b)
|
||||
}
|
||||
|
||||
func (t transport) Conn() net.Conn {
|
||||
return t.sock
|
||||
}
|
||||
|
||||
func (t transport) VerifyResponse() (err error) {
|
||||
var status string
|
||||
if status, err = t.ReadStringN(4); err != nil {
|
||||
@@ -103,6 +112,7 @@ func (t transport) Close() (err error) {
|
||||
if t.sock == nil {
|
||||
return nil
|
||||
}
|
||||
_ = DisableTimeWait(t.sock.(*net.TCPConn))
|
||||
return t.sock.Close()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user