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 10, 2025
1 parent 8e5d9fc commit b686a3e
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 @@ -234,12 +234,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 b686a3e

Please sign in to comment.