Browse Source

`retry` restored to fix comm error on app change

master
Thibaut Boustany 7 years ago
parent
commit
20297b6c2b
No known key found for this signature in database GPG Key ID: 32475B11A2B13EEC
  1. 3
      src/helpers/deviceAccess.js

3
src/helpers/deviceAccess.js

@ -4,6 +4,7 @@ import throttle from 'lodash/throttle'
import type Transport from '@ledgerhq/hw-transport'
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'
import { DisconnectedDevice, CantOpenDevice } from 'config/errors'
import { retry } from './promise'
// all open to device must use openDevice so we can prevent race conditions
// and guarantee we do one device access at a time. It also will handle the .close()
@ -39,7 +40,7 @@ export const withDevice: WithDevice = devicePath => job => {
busy = true
refreshBusyUIState()
try {
const t = await TransportNodeHid.open(devicePath).catch(mapError)
const t = await retry(() => TransportNodeHid.open(devicePath), { maxRetry: 1 }).catch(mapError).catch(mapError)
t.setDebugMode(logger.apdu)
try {
const res = await job(t).catch(mapError)

Loading…
Cancel
Save