Skip to content

Commit

Permalink
fix(ignore): ZBOSS: Catch error for cancel waiting (#1168)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirovilya authored Aug 30, 2024
1 parent 717f729 commit 53de8d4
Showing 1 changed file with 47 additions and 41 deletions.
88 changes: 47 additions & 41 deletions src/adapter/zboss/adapter/zbossAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,50 +431,56 @@ export class ZBOSSAdapter extends Adapter {
timeout,
);
}

const dataConfirmResult = await this.driver.request(
ieeeAddr,
0x0104,
zclFrame.cluster.ID,
endpoint,
sourceEndpoint || 0x01,
zclFrame.toBuffer(),
);
if (!dataConfirmResult) {
if (response != null) {
response.cancel();
try {
const dataConfirmResult = await this.driver.request(
ieeeAddr,
0x0104,
zclFrame.cluster.ID,
endpoint,
sourceEndpoint || 0x01,
zclFrame.toBuffer(),
);
if (!dataConfirmResult) {
if (response != null) {
response.cancel();
}
throw Error('sendZclFrameToEndpointInternal error');
}
throw Error('sendZclFrameToEndpointInternal error');
}
if (response !== null) {
try {
const result = await response.start().promise;
return result;
} catch (error) {
logger.debug(`Response timeout (${ieeeAddr}:${networkAddress},${responseAttempt})`, NS);
if (responseAttempt < 1 && !disableRecovery) {
return this.sendZclFrameToEndpointInternal(
ieeeAddr,
networkAddress,
endpoint,
sourceEndpoint,
zclFrame,
timeout,
disableResponse,
disableRecovery,
responseAttempt + 1,
dataRequestAttempt,
checkedNetworkAddress,
discoveredRoute,
assocRemove,
assocRestore,
);
} else {
throw error;
if (response !== null) {
try {
const result = await response.start().promise;
return result;
} catch (error) {
logger.debug(`Response timeout (${ieeeAddr}:${networkAddress},${responseAttempt})`, NS);
if (responseAttempt < 1 && !disableRecovery) {
return this.sendZclFrameToEndpointInternal(
ieeeAddr,
networkAddress,
endpoint,
sourceEndpoint,
zclFrame,
timeout,
disableResponse,
disableRecovery,
responseAttempt + 1,
dataRequestAttempt,
checkedNetworkAddress,
discoveredRoute,
assocRemove,
assocRestore,
);
} else {
throw error;
}
}
} else {
return;
}
} catch (error) {
if (response != null) {
response.cancel();
}
} else {
return;
throw error;
}
}

Expand Down

0 comments on commit 53de8d4

Please sign in to comment.