Adding end method to namedpipeinputchannel.
This commit is contained in:
Родитель
5618502cc8
Коммит
64b9bba353
|
@ -22,6 +22,7 @@ exports = module.exports = NamedPipeInputChannel;
|
|||
|
||||
function NamedPipeInputChannel() {
|
||||
this.closeOnRead = true;
|
||||
this.client = null;
|
||||
}
|
||||
|
||||
NamedPipeInputChannel.prototype.readInputChannel = function (name, parseXml, callback) {
|
||||
|
@ -60,18 +61,23 @@ NamedPipeInputChannel.prototype.readInputChannel = function (name, parseXml, cal
|
|||
});
|
||||
};
|
||||
|
||||
NamedPipeInputChannel.prototype.end = function () {
|
||||
this.client.end();
|
||||
};
|
||||
|
||||
NamedPipeInputChannel.prototype._readData = function (name, callback) {
|
||||
var self = this;
|
||||
var client = net.connect(name);
|
||||
client.on('data', function (data) {
|
||||
|
||||
self.client = net.connect(name);
|
||||
self.client.on('data', function (data) {
|
||||
if (self.closeOnRead) {
|
||||
client.end();
|
||||
self.client.end();
|
||||
}
|
||||
|
||||
callback(undefined, data);
|
||||
});
|
||||
|
||||
client.on('error', function (error) {
|
||||
self.client.on('error', function (error) {
|
||||
callback(error);
|
||||
});
|
||||
};
|
Загрузка…
Ссылка в новой задаче