/usr/lib/nodejs/node-xmpp/idle_timeout.js is in libnode-node-xmpp 0.2.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /**
* Emulates stream.setTimeout() behaviour, but respects outgoing data
* too.
*
* @param {Number} timeout Milliseconds
*/
exports.attach = function(stream, timeout) {
var timer;
var emitTimeout = function() {
timer = undefined;
stream.emit('timeout');
};
var updateTimer = function() {
if (timer)
clearTimeout(timer);
timer = setTimeout(emitTimeout, timeout);
};
var oldWrite = stream.write;
stream.write = function() {
updateTimer();
oldWrite.apply(this, arguments);
};
stream.addListener('data', updateTimer);
};
|