Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions IOSDeviceLib/IOSDeviceLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,7 @@ int main()
{
#ifdef _WIN32
_setmode(_fileno(stdout), _O_BINARY);
_setmode(_fileno(stderr), _O_BINARY);

if (load_dlls())
{
Expand Down
10 changes: 1 addition & 9 deletions message-unpack-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,14 @@ exports.MessageUnpackStream = class MessageUnpackStream extends stream.Transform
this.push(messageBuffer);
this._endUnpackingMessages(done);
}
} else if (this._unfinishedMessage.length && data.length >= HeaderSize) {
} else {
// Append the new data to the unfinished message and try to unpack again.
const concatenatedMessage = Buffer.concat([this._unfinishedMessage, data]);

// Clear the unfinished message buffer.
this._unfinishedMessage = new Buffer(0);
this._transform(concatenatedMessage);
this._endUnpackingMessages(done);
} else {
// While debugging the data here contains one character - \0, null or 0.
// I think we get here when the Node inner buffer for the data of the data event
// is filled with data and the last symbol is a part of the length header of the next message.
// That's why we need this concat.
// This code is tested with 10 000 000 messages in while loop.
this._unfinishedMessage = Buffer.concat([this._unfinishedMessage, data]);
this._endUnpackingMessages(done);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ios-device-lib",
"version": "0.4.8",
"version": "0.4.9",
"description": "",
"types": "./typings/ios-device-lib.d.ts",
"main": "index.js",
Expand Down