mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Update STFService.apk to 1.1.0. Switches to abstract sockets which fixes
adb getting stuck when tethering is being used.
This commit is contained in:
parent
94fd18aedf
commit
33e4e617bb
4 changed files with 14 additions and 41 deletions
|
@ -9,58 +9,31 @@ function closedError(err) {
|
|||
return err.message.indexOf('closed') !== -1
|
||||
}
|
||||
|
||||
devutil.ensureUnusedPort = function(adb, serial, port) {
|
||||
return adb.openTcp(serial, port)
|
||||
devutil.ensureUnusedLocalSocket = function(adb, serial, sock) {
|
||||
return adb.openLocal(serial, sock)
|
||||
.then(function(conn) {
|
||||
conn.end()
|
||||
throw new Error(util.format('Port "%d" should be unused', port))
|
||||
throw new Error(util.format('Local socket "%s" should be unused', sock))
|
||||
})
|
||||
.catch(closedError, function() {
|
||||
return Promise.resolve(port)
|
||||
return Promise.resolve(sock)
|
||||
})
|
||||
}
|
||||
|
||||
devutil.waitForPort = function(adb, serial, port) {
|
||||
return adb.openTcp(serial, port)
|
||||
devutil.waitForLocalSocket = function(adb, serial, sock) {
|
||||
return adb.openLocal(serial, sock)
|
||||
.then(function(conn) {
|
||||
conn.port = port
|
||||
conn.sock = sock
|
||||
return conn
|
||||
})
|
||||
.catch(closedError, function() {
|
||||
return Promise.delay(100)
|
||||
.then(function() {
|
||||
return devutil.waitForPort(adb, serial, port)
|
||||
return devutil.waitForLocalSocket(adb, serial, sock)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
devutil.waitForPortToFree = function(adb, serial, port) {
|
||||
return adb.openTcp(serial, port)
|
||||
.then(function(conn) {
|
||||
var resolver = Promise.defer()
|
||||
|
||||
function endListener() {
|
||||
resolver.resolve(port)
|
||||
}
|
||||
|
||||
function errorListener(err) {
|
||||
resolver.reject(err)
|
||||
}
|
||||
|
||||
conn.on('end', endListener)
|
||||
conn.on('error', errorListener)
|
||||
|
||||
return resolver.promise.finally(function() {
|
||||
conn.removeListener('end', endListener)
|
||||
conn.removeListener('error', errorListener)
|
||||
conn.end()
|
||||
})
|
||||
})
|
||||
.catch(closedError, function() {
|
||||
return port
|
||||
})
|
||||
}
|
||||
|
||||
devutil.listPidsByComm = function(adb, serial, comm, bin) {
|
||||
var users = {
|
||||
shell: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue