-
Notifications
You must be signed in to change notification settings - Fork 5
/
streaminput.js
30 lines (29 loc) · 971 Bytes
/
streaminput.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var events = require('events');
var util = require('util');
var underscore = require('underscore');
var protocol = require('./protocol');
var net = require('net');
var dateformat = require("dateformat");
var argv = require("./argvparser");
exports.StreamInput = function(stream, reverseRoles) {
var self = this;
stream.on("error", function (err) {
if (argv.options.verbose && underscore.include(argv.options.verbose, 'disconnect')) {
console.log(err);
}
stream.destroy();
});
stream.on("timeout", function () {
if (argv.options.verbose && underscore.include(argv.options.verbose, 'disconnect')) {
console.log("Timeout");
}
self.stream.end();
});
stream.on("end", function () {
if (argv.options.verbose && underscore.include(argv.options.verbose, 'disconnect')) {
console.log("End");
}
});
protocol.Protocol.call(self, stream, true, reverseRoles);
}
util.inherits(exports.StreamInput, protocol.Protocol);