Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
fix trezord unexpected message loop (#561)
Browse files Browse the repository at this point in the history
* fix trezord unexpected message loop

* Update DeviceCommands.js
  • Loading branch information
szymonlesisz authored Apr 16, 2020
1 parent 82f1d6a commit b93b092
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/js/device/DeviceCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,15 @@ export default class DeviceCommands {
}

const response: DefaultMessageResponse = await this._commonCall(type, msg);
assertType(response, resType);
try {
assertType(response, resType);
} catch (error) {
// handle possible race condition
// Bridge may have some unread message in buffer, read it
await this.transport.read(this.sessionId, false);
// throw error anyway, next call should be resolved properly
throw error;
}
return response;
}

Expand Down

0 comments on commit b93b092

Please sign in to comment.