Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
fix sendBatch bug
Browse files Browse the repository at this point in the history
Change-Id: I9e05ed241ef2ef8097f781898f775685544aa6ec
  • Loading branch information
py8765 committed Dec 6, 2013
1 parent 2ab0f07 commit 2fb9b43
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/connectors/hybridsocket.js
Expand Up @@ -73,7 +73,6 @@ Socket.prototype.send = function(msg) {
} else if(!(msg instanceof Buffer)) {
msg = new Buffer(JSON.stringify(msg));
}

this.sendRaw(Package.encode(Package.TYPE_DATA, msg));
};

Expand All @@ -83,7 +82,12 @@ Socket.prototype.send = function(msg) {
* @param {Buffer} msgs byte data
*/
Socket.prototype.sendBatch = function(msgs) {
this.send(Buffer.concat(msgs));
var rs = [];
for(var i=0; i<msgs.length; i++) {
var src = Package.encode(Package.TYPE_DATA, msgs[i]);
rs.push(src);
}
this.sendRaw(Buffer.concat(rs));
};

/**
Expand Down

0 comments on commit 2fb9b43

Please sign in to comment.