Skip to content

Commit

Permalink
Fix stackoverflow in recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Apr 26, 2015
1 parent 482d324 commit 29302ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Client.prototype.setSocket = function(socket) {
incomingBuffer = incomingBuffer.slice(packetLengthField.size + packetLengthField.value);
if (self.compressionThreshold == -2)
{
afterParse(null, parsePacketData(buf, self.state, self.isServer, self.packetsToParse));
setImmediate(afterParse, null, parsePacketData(buf, self.state, self.isServer, self.packetsToParse));
} else {
parseNewStylePacket(buf, self.state, self.isServer, self.packetsToParse, afterParse);
}
Expand Down
2 changes: 1 addition & 1 deletion src/protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ function parseNewStylePacket(buffer, state, isServer, packetsToParse, cb) {
}
});
} else {
cb(null, parsePacketData(buf, state, isServer, packetsToParse));
setImmediate(cb, null, parsePacketData(buf, state, isServer, packetsToParse));
}
}

Expand Down

0 comments on commit 29302ad

Please sign in to comment.