MCPcopy
hub / github.com/openstf/stf / tryConnect

Function tryConnect

lib/units/device/plugins/touch/index.js:261–276  ·  view source on GitHub ↗
(times, delay)

Source from the content-addressed store, hash-verified

259
260 TouchConsumer.prototype._connectService = function() {
261 function tryConnect(times, delay) {
262 return adb.openLocal(options.serial, 'localabstract:minitouch')
263 .timeout(10000)
264 .then(function(out) {
265 return out
266 })
267 .catch(function(err) {
268 if (/closed/.test(err.message) && times > 1) {
269 return Promise.delay(delay)
270 .then(function() {
271 return tryConnect(times - 1, delay * 2)
272 })
273 }
274 return Promise.reject(err)
275 })
276 }
277 log.info('Connecting to minitouch service')
278 // SH-03G can be very slow to start sometimes. Make sure we try long
279 // enough.

Callers 1

index.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected