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

fix trezord unexpected message loop #561

Merged
merged 2 commits into from
Apr 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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