Skip to content

Commit

Permalink
fix resends without delay
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Sep 12, 2023
1 parent 81df8cb commit c728532
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/Af.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ class Af extends EventEmitter {
let shouldResend = false
let signalTimeout = Q.defer()
try {
let areqCancelable = this.waitFor(afEventCnf, areqTimeout)
areqCancelable.catch(() => { })
let areqCancelable

const startAreq = async () => {
let cnf
Expand All @@ -282,8 +281,6 @@ class Af extends EventEmitter {

if (shouldResend) {
shouldResend = false
areqCancelable = this.waitFor(afEventCnf, areqTimeout)
areqCancelable.catch(() => { })
await afSend()
}
} while (shouldResend)
Expand All @@ -303,6 +300,9 @@ class Af extends EventEmitter {

let isResend = false
const afSend = async () => {
areqCancelable = this.waitFor(afEventCnf, areqTimeout)
areqCancelable.catch(() => { })

let rsp
if (!isBroadcast && dstEp.getSrcRtg && !isResend) {
const srcRtg = dstEp.getSrcRtg()
Expand Down
4 changes: 2 additions & 2 deletions lib/AfController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const EventEmitter = require('eventemitter2')
const Q = require('@halleyassist/q-lite')
const debug = require('debug')("zigbee-shepherd:afc")
const debug = require('debug')("zstack-af:controller")

class AfController extends EventEmitter {
constructor(){
Expand Down Expand Up @@ -78,7 +78,7 @@ class AfController extends EventEmitter {

// Perform send
if(i != 1) {
debug(`Doing indirect send attempt #${i}/${retries}`)
debug(`Doing indirect send attempt ${i}/${retries}`)
}

workPromise = sendFn()
Expand Down

0 comments on commit c728532

Please sign in to comment.