diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-11-16 19:08:29 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-11-16 19:08:29 +0800 |
| commit | 434aa8343fdcbb4d5002f934979913c099489bee (patch) | |
| tree | 55bab4ec5a6151be57797d34f61faf5ea744471b /frontend-old/node_modules/websocket-extensions/lib/pipeline/cell.js | |
| parent | 893c388d4e99442a36005e5971a87730623f946e (diff) | |
sdk, del
Diffstat (limited to 'frontend-old/node_modules/websocket-extensions/lib/pipeline/cell.js')
| -rw-r--r-- | frontend-old/node_modules/websocket-extensions/lib/pipeline/cell.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/frontend-old/node_modules/websocket-extensions/lib/pipeline/cell.js b/frontend-old/node_modules/websocket-extensions/lib/pipeline/cell.js deleted file mode 100644 index b2901ba..0000000 --- a/frontend-old/node_modules/websocket-extensions/lib/pipeline/cell.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -var Functor = require('./functor'), - Pledge = require('./pledge'); - -var Cell = function(tuple) { - this._ext = tuple[0]; - this._session = tuple[1]; - - this._functors = { - incoming: new Functor(this._session, 'processIncomingMessage'), - outgoing: new Functor(this._session, 'processOutgoingMessage') - }; -}; - -Cell.prototype.pending = function(direction) { - var functor = this._functors[direction]; - if (!functor._stopped) functor.pending += 1; -}; - -Cell.prototype.incoming = function(error, message, callback, context) { - this._exec('incoming', error, message, callback, context); -}; - -Cell.prototype.outgoing = function(error, message, callback, context) { - this._exec('outgoing', error, message, callback, context); -}; - -Cell.prototype.close = function() { - this._closed = this._closed || new Pledge(); - this._doClose(); - return this._closed; -}; - -Cell.prototype._exec = function(direction, error, message, callback, context) { - this._functors[direction].call(error, message, function(err, msg) { - if (err) err.message = this._ext.name + ': ' + err.message; - callback.call(context, err, msg); - this._doClose(); - }, this); -}; - -Cell.prototype._doClose = function() { - var fin = this._functors.incoming, - fout = this._functors.outgoing; - - if (!this._closed || fin.pending + fout.pending !== 0) return; - if (this._session) this._session.close(); - this._session = null; - this._closed.done(); -}; - -module.exports = Cell; |
