Skip to content

Commit

Permalink
fix(transport): transferOut timeout must be inside try block
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed Feb 5, 2025
1 parent 126ad48 commit 022e194
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/transport/src/api/usb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,13 @@ export class UsbApi extends AbstractApi {
const newArray = new Uint8Array(this.chunkSize);
newArray.set(new Uint8Array(buffer));

const timeout = setTimeout(() => {
this.logger?.debug('usb: device.transfer out take suspiciously long. timing out.');
device?.reset();
}, 1000);

let timeout;
try {
timeout = setTimeout(() => {
this.logger?.debug('usb: device.transfer out take suspiciously long. timing out.');
device?.reset();
}, 1000);

// https://wicg.github.io/webusb/#ref-for-dom-usbdevice-transferout
this.logger?.debug('usb: device.transferOut');

Expand Down

0 comments on commit 022e194

Please sign in to comment.