-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
Optimize Connect handler #301
Merged
mcollina
merged 11 commits into
moscajs:master
from
gnought:feature/optimize_connect_handler
Aug 23, 2019
Merged
Optimize Connect handler #301
mcollina
merged 11 commits into
moscajs:master
from
gnought:feature/optimize_connect_handler
Aug 23, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- For moscajs@06fc839, raise an "invalid protocol" callback error if there is - aedes unsupported mqtt version: CONNACK return Code = 1 - client id length > 23 [MQTT 3.1.0 only]: CONNACK return Code = 2 - Added preConnect handler in handleConnect between earliest connect checks and normal checks. This is useful for users if they want to do some earilest DDoS check before server send any responses back, in this phrase connected=false - Emit `connackSent` event and set connactSent=true if CONNACK is sent, not only after `client` event but also when normal connect checks phrase if necessary - Added packet arguments in `connackSent` event - set clientID to 'aedes_' + shortid() if empty [MQTT 3.1.1], it is better to keep it within 23 chars for better compatibility - Emit `clientReady` event after we send back all offline messages to client - Optimize negate function - Optimize doConnack function and we could re-use it - Set keepalive after authentication, save some resoures if there are plenty of failed authentication
mcollina
reviewed
Aug 14, 2019
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.
Can you please add the docs for preConnect?
mcollina
reviewed
Aug 14, 2019
mcollina
approved these changes
Aug 23, 2019
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For 06fc839, raise an "invalid protocol" callback error if there is
aedes unsupported mqtt version: CONNACK return Code = 1
client id length > 23 [MQTT 3.1.0 only]: CONNACK return Code = 2
Added preConnect handler in handleConnect between earliest connect checks and normal checks. This is useful for users if they want to do some earilest DDoS check before server send any responses back, in this phrase connected=false
Emit
connackSent
event and set connactSent=true if CONNACK is sent, not only afterclient
event but also when normal connect checks phrase if necessaryAdded packet arguments in
connackSent
eventnot use uuid(), set clientID to 'aedes_' + shortid() if empty [MQTT 3.1.1], it is better to keep it within 23 chars for better compatibility
Emit
clientReady
event after we send back all offline messages to client, for issue Duplicate PUBLISH packets in directly push to a QoS 2 client. #281Optimize negate function
Optimize doConnack function and we could re-use it
Set keepalive after authentication, save some resources if there are plenty of failed authentication
Clear connect timer earliest in handleConnect before preConnect, performance-wise & memory-wise if there is DDoS