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

Method windowChange

lib/protocol/Protocol.js:1151–1183  ·  view source on GitHub ↗
(chan, rows, cols, height, width)

Source from the content-addressed store, hash-verified

1149 sendPacket(this, this._packetRW.write.finalize(packet));
1150 }
1151 windowChange(chan, rows, cols, height, width) {
1152 if (this._server)
1153 throw new Error('Client-only method called in server mode');
1154
1155 // Does not consume window space
1156
1157 let p = this._packetRW.write.allocStart;
1158 const packet = this._packetRW.write.alloc(
1159 1 + 4 + 4 + 13 + 1 + 4 + 4 + 4 + 4
1160 );
1161
1162 packet[p] = MESSAGE.CHANNEL_REQUEST;
1163
1164 writeUInt32BE(packet, chan, ++p);
1165
1166 writeUInt32BE(packet, 13, p += 4);
1167 packet.utf8Write('window-change', p += 4, 13);
1168
1169 packet[p += 13] = 0;
1170
1171 writeUInt32BE(packet, cols, ++p);
1172
1173 writeUInt32BE(packet, rows, p += 4);
1174
1175 writeUInt32BE(packet, width, p += 4);
1176
1177 writeUInt32BE(packet, height, p += 4);
1178
1179 this._debug && this._debug(
1180 `Outbound: Sending CHANNEL_REQUEST (r:${chan}, window-change)`
1181 );
1182 sendPacket(this, this._packetRW.write.finalize(packet));
1183 }
1184 pty(chan, rows, cols, height, width, term, modes, wantReply) {
1185 if (this._server)
1186 throw new Error('Client-only method called in server mode');

Callers 1

setWindowMethod · 0.80

Calls 3

writeUInt32BEFunction · 0.85
allocMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected