-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added authorizeForward #44
Conversation
Uhm, seems I didn't cover all my bases in the unit test. I could look into it a bit more if that's a problem |
A bad design decision I did in Mosca is making that function async. That Would you mind making it sync?
|
I thought it was strange the performance dropped after I added the callback. |
@cristian-stoicescu just return the packet, so the function can overwrite anything. BTW, I know it's a lot of work for this feature, thanks for helping out! |
… prevent the sending of the message to the client
var _authPacket = that.broker.authorizeForward(that, _packet) | ||
if (util.isNullOrUndefined(_authPacket)) { | ||
// we consider this to be an error, since the packet is undefined, so there's nothing to send | ||
that.broker.persistence.outgoingClearMessageId(that, _packet, function () {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't allocate a function here.
…rt all tested platforms
@@ -75,11 +75,17 @@ function Client (broker, conn) { | |||
} | |||
|
|||
this.deliverQoS = function deliverQoS (_packet, cb) { | |||
var _authPacket = that.broker.authorizeForward(that, _packet) | |||
if (util.isNullOrUndefined(_authPacket)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just check if (!_authPacket)
Sorry for the tons of commits, github has a habit of hiding "outdated" comments, so I see them too late |
…ue only when the client is not clean
…ue only when the client is not clean
…ue only when the client is not clean
Actually no, there is no need to check, those methods are only used for
|
… only packages of that type reach the function
You need to do the same for the other deliver method, as one is used for QoS 0 and one for QoS 1/2. |
Didn't you say earlier that the I'm confused p.s.: sorry, closed by mistake |
Hello. I've added the method we talked about. However, I'm not very sure about the arguments of the callback. Right now, it only looks at err, the rest being modified on the original object.
I did see a slight drop in perfomance, about 2-5% after adding the method, without supplying anything custom in the config.