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

Method channelOpenFail

lib/protocol/Protocol.js:526–553  ·  view source on GitHub ↗
(remote, reason, desc)

Source from the content-addressed store, hash-verified

524 sendPacket(this, this._packetRW.write.finalize(packet));
525 }
526 channelOpenFail(remote, reason, desc) {
527 if (typeof desc !== 'string')
528 desc = '';
529
530 const descLen = Buffer.byteLength(desc);
531 let p = this._packetRW.write.allocStart;
532 const packet = this._packetRW.write.alloc(1 + 4 + 4 + 4 + descLen + 4);
533
534 packet[p] = MESSAGE.CHANNEL_OPEN_FAILURE;
535
536 writeUInt32BE(packet, remote, ++p);
537
538 writeUInt32BE(packet, reason, p += 4);
539
540 writeUInt32BE(packet, descLen, p += 4);
541
542 p += 4;
543 if (descLen) {
544 packet.utf8Write(desc, p, descLen);
545 p += descLen;
546 }
547
548 writeUInt32BE(packet, 0, p); // Empty language tag
549
550 this._debug
551 && this._debug(`Outbound: Sending CHANNEL_OPEN_FAILURE (r:${remote})`);
552 sendPacket(this, this._packetRW.write.finalize(packet));
553 }
554
555 // ===========================================================================
556 // Client-specific ===========================================================

Callers 4

rejectFunction · 0.80
constructorMethod · 0.80
rejectMethod · 0.80
handlers.misc.jsFile · 0.80

Calls 3

writeUInt32BEFunction · 0.85
allocMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected