Skip to content

Commit

Permalink
Clear socket.waiting before invoking callbacks (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslee authored and hyperlink committed Feb 20, 2018
1 parent b56571f commit 850e2d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,10 @@ Client.prototype.handleReceivedData = function (socket) {
var size = buffer.readUInt32BE(0) + 4;

if (buffer.length >= size) {
if (socket.longpolling) {
socket.waiting = false;
}

var resp = buffer.shallowSlice(0, size);
var correlationId = resp.readUInt32BE(4);
var handlers = this.unqueueCallback(socket, correlationId);
Expand All @@ -772,9 +776,6 @@ Client.prototype.handleReceivedData = function (socket) {
logger.error(`missing handlers for Correlation ID: ${correlationId}`);
}
buffer.consume(size);
if (socket.longpolling) {
socket.waiting = false;
}
} else {
return;
}
Expand Down

0 comments on commit 850e2d6

Please # to comment.