Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

send suback 0x80 if subscribe authorization fails #170

Merged
merged 2 commits into from
Jul 8, 2014

Conversation

mocheng
Copy link
Contributor

@mocheng mocheng commented Jul 8, 2014

To fix #124

Since each topic should be handled respectively, I move the logic to "filter subscription already in client.subscription" into async.parallel. Just to make the indexing of authorized match packet.subscriptions.

@mcollina
Copy link
Collaborator

mcollina commented Jul 8, 2014

Instead of async.parallel, use async.each, it's faster in this case. (I would love to refactor the whole Mosca :)).

@mocheng
Copy link
Contributor Author

mocheng commented Jul 8, 2014

async.each just iterates the array without collecting results.

With async.parallel, we have auth result s for each topic stored in the authorized arguments in 2nd callback argument of `async.parallel'.

@mcollina
Copy link
Collaborator

mcollina commented Jul 8, 2014

Yep, you can use async.map in its place. These are much lighter as they do not allocate a function for each subscription.

@mocheng
Copy link
Contributor Author

mocheng commented Jul 8, 2014

Cool 👍

I really should watch closer on performance tips:)

mcollina added a commit that referenced this pull request Jul 8, 2014
send suback 0x80 if subscribe authorization fails
@mcollina mcollina merged commit bc55950 into moscajs:master Jul 8, 2014
@mocheng mocheng deleted the fix_124_169 branch July 8, 2014 14:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use 0x80 code for negated subscription
2 participants