Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nguyenthenguyen
Copy link
Contributor

Fixed for crash at comment

@nguyenthenguyen nguyenthenguyen mentioned this pull request Aug 13, 2018
}
}
})
that.will = null // this function might be called twice
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this line here allows the function to be called twice. You should leave this line, and make an in-closure variable for that.will.

lib/client.js Outdated
}
})
that.will = null // this function might be called twice
that._finished = true // this function might be called twice
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a better solution is to extract that.will into a variable, and keep that into the context of the closure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcollina Thanks you, sir!

test/will.js Outdated
let authorized = false
var opts = {}
// willConnect populates opts with a will
var s = willConnect(setup(aedes({ authorizePublish: (_1, _2, callback) => { authorized = true; setTimeout(() => { callback(null) }, 10) } })), opts)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you shorten up the line and use a setImmediate instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcollina Thanks you, sir!

…zePublish and use setImmediate instead of setTimeout in will test
@mcollina mcollina merged commit 09f0070 into moscajs:master Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants