Browse files

added callback support for all write methods

  • Loading branch information...
1 parent f2fbfaf commit 4ec374dfea609b51e08baa384f14b3cf8548b24e @jfd jfd committed Apr 12, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 index.js
View
8 index.js
@@ -162,7 +162,7 @@ Connection.prototype.writeData = function(ch, priority, data, callback) {
data = new Buffer(data, "utf8");
}
- return this._writePacket(ch, DATA << 4 | priority, data);
+ return this._writePacket(ch, DATA << 4 | priority, data, callback);
};
Connection.prototype.writeSignal = function(ch, type, data, callback) {
@@ -175,11 +175,11 @@ Connection.prototype.writeSignal = function(ch, type, data, callback) {
data = new Buffer(data, "utf8");
}
- return this._writePacket(ch, SIGNAL << 4 | type, data);
+ return this._writePacket(ch, SIGNAL << 4 | type, data, callback);
};
-Connection.prototype._writePacket = function(ch, flag, data) {
+Connection.prototype._writePacket = function(ch, flag, data, callback) {
var length = 8 + data.length;
var packet = new Buffer(length);
@@ -198,7 +198,7 @@ Connection.prototype._writePacket = function(ch, flag, data) {
data.copy(packet, 8, 0);
}
- return this.write(packet);
+ return this.write(packet, callback);
} catch (writeException) {
this.destroy(writeException);
return false;

0 comments on commit 4ec374d

Please sign in to comment.