MCPcopy Create free account
hub / github.com/mscdex/ssh2 / _destruct

Method _destruct

lib/protocol/Protocol.js:293–307  ·  view source on GitHub ↗
(reason)

Source from the content-addressed store, hash-verified

291 };
292 }
293 _destruct(reason) {
294 this._packetRW.read.cleanup();
295 this._packetRW.write.cleanup();
296 this._cipher && this._cipher.free();
297 this._decipher && this._decipher.free();
298 if (typeof reason !== 'string' || reason.length === 0)
299 reason = 'fatal error';
300 this.parse = () => {
301 throw new Error(`Instance unusable after ${reason}`);
302 };
303 this._onWrite = () => {
304 throw new Error(`Instance unusable after ${reason}`);
305 };
306 this._destruct = undefined;
307 }
308 cleanup() {
309 this._destruct && this._destruct();
310 }

Callers 2

cleanupMethod · 0.95
utils.jsFile · 0.80

Calls 2

cleanupMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected