Skip to content

Performance Fixes - #65

Open
kelchy wants to merge 16 commits into
node-diameter:masterfrom
kelchy:master
Open

Performance Fixes#65
kelchy wants to merge 16 commits into
node-diameter:masterfrom
kelchy:master

Conversation

@kelchy

@kelchy kelchy commented Apr 16, 2018

Copy link
Copy Markdown

when there is a parsing error (i.e. unknown dictionary entry)
the buffer will not be spliced because of the try catch hence ending up in infinite loop
seen this couple of times when under heavy load

@kelchy kelchy changed the title Prevent infinite loop on diameter error Performance Fixes May 9, 2018
Comment thread lib/diameter-codec.js Outdated

var decodeAvpHeader = function(buffer, start) {
var avp = {};
if (buffer.length - start - DIAMETER_MESSAGE_AVP_CODE < 4) return undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd suggest returning null instead of undefined when the contract for a function is to return an object. null can be viewed as having an "invalid object" meaning.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

good idea, i'll update the PR.
also found more issues

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.

2 participants