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

Function tryConnect

lib/units/device/plugins/screen/stream.js:278–293  ·  view source on GitHub ↗
(times, delay)

Source from the content-addressed store, hash-verified

276
277 FrameProducer.prototype._connectService = function() {
278 function tryConnect(times, delay) {
279 return adb.openLocal(options.serial, 'localabstract:minicap')
280 .timeout(10000)
281 .then(function(out) {
282 return out
283 })
284 .catch(function(err) {
285 if (/closed/.test(err.message) && times > 1) {
286 return Promise.delay(delay)
287 .then(function() {
288 return tryConnect(times - 1, delay * 2)
289 })
290 }
291 return Promise.reject(err)
292 })
293 }
294 log.info('Connecting to minicap service')
295 return tryConnect(5, 100)
296 }

Callers 1

stream.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected