ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 18.118.138.191 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/cms/node_modules/websocket-extensions/lib/pipeline/ |
Upload File : |
'use strict'; var Cell = require('./cell'), Pledge = require('./pledge'); var Pipeline = function(sessions) { this._cells = sessions.map(function(session) { return new Cell(session) }); this._stopped = {incoming: false, outgoing: false}; }; Pipeline.prototype.processIncomingMessage = function(message, callback, context) { if (this._stopped.incoming) return; this._loop('incoming', this._cells.length - 1, -1, -1, message, callback, context); }; Pipeline.prototype.processOutgoingMessage = function(message, callback, context) { if (this._stopped.outgoing) return; this._loop('outgoing', 0, this._cells.length, 1, message, callback, context); }; Pipeline.prototype.close = function(callback, context) { this._stopped = {incoming: true, outgoing: true}; var closed = this._cells.map(function(a) { return a.close() }); if (callback) Pledge.all(closed).then(function() { callback.call(context) }); }; Pipeline.prototype._loop = function(direction, start, end, step, message, callback, context) { var cells = this._cells, n = cells.length, self = this; while (n--) cells[n].pending(direction); var pipe = function(index, error, msg) { if (index === end) return callback.call(context, error, msg); cells[index][direction](error, msg, function(err, m) { if (err) self._stopped[direction] = true; pipe(index + step, err, m); }); }; pipe(start, null, message); }; module.exports = Pipeline;