MCPcopy
hub / github.com/nirui/sshwifty / set

Method set

ui/stream/header.js:231–251  ·  view source on GitHub ↗

* Set the header * * @param {number} commandID Command ID * @param {number} data Stream data * @param {boolean} success Whether or not the request is successful *

(commandID, data, success)

Source from the content-addressed store, hash-verified

229 *
230 */
231 set(commandID, data, success) {
232 if (commandID > 0x0f) {
233 throw new Exception("Command ID must not greater than 0x0f", false);
234 }
235
236 if (data > InitialStream.maxDataSize()) {
237 throw new Exception("Data must not greater than 0x07ff", false);
238 }
239
240 let dd = data & InitialStream.maxDataSize();
241
242 if (success) {
243 dd |= 0x0800;
244 }
245
246 this.headerByte1 = 0;
247 this.headerByte1 |= commandID << 4;
248 this.headerByte1 |= dd >> 8;
249 this.headerByte2 = 0;
250 this.headerByte2 |= dd & 0xff;
251 }
252}
253
254/**

Callers 1

sendMethod · 0.95

Calls 1

maxDataSizeMethod · 0.80

Tested by

no test coverage detected