@xulongzhe/clawbench-desktop-linux-x64-payload 0.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -0
- package/payload.json +4 -0
- package/resources/app.asar +0 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/.eslintrc.js +5 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/LICENSE +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/build/Release/cpufeatures.node +0 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/build/deps/cpu_features/cpu_features.Makefile +6 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/buildcheck.gypi +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/buildcheck.js +32 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.clang-format +4 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.dockerignore +31 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +21 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +329 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +261 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +23 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/LICENSE +230 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/README.md +272 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/WORKSPACE +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +5 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +11 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +3 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +3 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/README.md +30 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +252 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +40 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +64 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +312 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +7 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +48 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +34 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +22 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +11 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +107 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +15 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +105 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +54 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +384 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +259 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +121 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +74 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +149 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +72 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +108 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +288 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +40 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +37 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +39 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +240 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +49 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +110 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +70 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +60 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +4 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +205 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +320 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +12 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +456 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +165 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +75 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +490 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +79 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/copy.inl +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +86 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +26 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/equals.inl +22 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +62 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +169 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +88 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +79 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +82 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +138 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +212 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +93 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +163 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +111 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +120 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +2055 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +68 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +58 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +57 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +58 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +132 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/string_view.c +192 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +461 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +114 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +61 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +31 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/lib/index.js +5 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/package.json +28 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/.eslintignore +4 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/.eslintrc.js +5 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/LICENSE +19 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/SFTP.md +413 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/install.js +27 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/Channel.js +295 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/agent.js +1123 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/client.js +2176 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/http-agents.js +84 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/index.js +44 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/keygen.js +582 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/constants.js +356 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node +0 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/handlers.js +16 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/kex.js +1908 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/utils.js +356 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/zlib.js +255 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/server.js +1380 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/utils.js +336 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/package.json +32 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/util/build_pagent.bat +2 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/util/pagent.c +88 -0
- package/resources/login.html +1777 -0
- package/resources/logo.png +0 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
Duplex: DuplexStream,
|
|
5
|
+
Readable: ReadableStream,
|
|
6
|
+
Writable: WritableStream,
|
|
7
|
+
} = require('stream');
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
CHANNEL_EXTENDED_DATATYPE: { STDERR },
|
|
11
|
+
} = require('./protocol/constants.js');
|
|
12
|
+
const { bufferSlice } = require('./protocol/utils.js');
|
|
13
|
+
|
|
14
|
+
const PACKET_SIZE = 32 * 1024;
|
|
15
|
+
const MAX_WINDOW = 2 * 1024 * 1024;
|
|
16
|
+
const WINDOW_THRESHOLD = MAX_WINDOW / 2;
|
|
17
|
+
|
|
18
|
+
class ClientStderr extends ReadableStream {
|
|
19
|
+
constructor(channel, streamOpts) {
|
|
20
|
+
super(streamOpts);
|
|
21
|
+
|
|
22
|
+
this._channel = channel;
|
|
23
|
+
}
|
|
24
|
+
_read(n) {
|
|
25
|
+
if (this._channel._waitChanDrain) {
|
|
26
|
+
this._channel._waitChanDrain = false;
|
|
27
|
+
if (this._channel.incoming.window <= WINDOW_THRESHOLD)
|
|
28
|
+
windowAdjust(this._channel);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class ServerStderr extends WritableStream {
|
|
34
|
+
constructor(channel) {
|
|
35
|
+
super({ highWaterMark: MAX_WINDOW });
|
|
36
|
+
|
|
37
|
+
this._channel = channel;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_write(data, encoding, cb) {
|
|
41
|
+
const channel = this._channel;
|
|
42
|
+
const protocol = channel._client._protocol;
|
|
43
|
+
const outgoing = channel.outgoing;
|
|
44
|
+
const packetSize = outgoing.packetSize;
|
|
45
|
+
const id = outgoing.id;
|
|
46
|
+
let window = outgoing.window;
|
|
47
|
+
const len = data.length;
|
|
48
|
+
let p = 0;
|
|
49
|
+
|
|
50
|
+
if (outgoing.state !== 'open')
|
|
51
|
+
return;
|
|
52
|
+
|
|
53
|
+
while (len - p > 0 && window > 0) {
|
|
54
|
+
let sliceLen = len - p;
|
|
55
|
+
if (sliceLen > window)
|
|
56
|
+
sliceLen = window;
|
|
57
|
+
if (sliceLen > packetSize)
|
|
58
|
+
sliceLen = packetSize;
|
|
59
|
+
|
|
60
|
+
if (p === 0 && sliceLen === len)
|
|
61
|
+
protocol.channelExtData(id, data, STDERR);
|
|
62
|
+
else
|
|
63
|
+
protocol.channelExtData(id, bufferSlice(data, p, p + sliceLen), STDERR);
|
|
64
|
+
|
|
65
|
+
p += sliceLen;
|
|
66
|
+
window -= sliceLen;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
outgoing.window = window;
|
|
70
|
+
|
|
71
|
+
if (len - p > 0) {
|
|
72
|
+
if (window === 0)
|
|
73
|
+
channel._waitWindow = true;
|
|
74
|
+
if (p > 0)
|
|
75
|
+
channel._chunkErr = bufferSlice(data, p, len);
|
|
76
|
+
else
|
|
77
|
+
channel._chunkErr = data;
|
|
78
|
+
channel._chunkcbErr = cb;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
cb();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
class Channel extends DuplexStream {
|
|
87
|
+
constructor(client, info, opts) {
|
|
88
|
+
const streamOpts = {
|
|
89
|
+
highWaterMark: MAX_WINDOW,
|
|
90
|
+
allowHalfOpen: (!opts || (opts && opts.allowHalfOpen !== false)),
|
|
91
|
+
emitClose: false,
|
|
92
|
+
};
|
|
93
|
+
super(streamOpts);
|
|
94
|
+
this.allowHalfOpen = streamOpts.allowHalfOpen;
|
|
95
|
+
|
|
96
|
+
const server = !!(opts && opts.server);
|
|
97
|
+
|
|
98
|
+
this.server = server;
|
|
99
|
+
this.type = info.type;
|
|
100
|
+
this.subtype = undefined;
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
incoming and outgoing contain these properties:
|
|
104
|
+
{
|
|
105
|
+
id: undefined,
|
|
106
|
+
window: undefined,
|
|
107
|
+
packetSize: undefined,
|
|
108
|
+
state: 'closed'
|
|
109
|
+
}
|
|
110
|
+
*/
|
|
111
|
+
this.incoming = info.incoming;
|
|
112
|
+
this.outgoing = info.outgoing;
|
|
113
|
+
this._callbacks = [];
|
|
114
|
+
|
|
115
|
+
this._client = client;
|
|
116
|
+
this._hasX11 = false;
|
|
117
|
+
this._exit = {
|
|
118
|
+
code: undefined,
|
|
119
|
+
signal: undefined,
|
|
120
|
+
dump: undefined,
|
|
121
|
+
desc: undefined,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
this.stdin = this.stdout = this;
|
|
125
|
+
|
|
126
|
+
if (server)
|
|
127
|
+
this.stderr = new ServerStderr(this);
|
|
128
|
+
else
|
|
129
|
+
this.stderr = new ClientStderr(this, streamOpts);
|
|
130
|
+
|
|
131
|
+
// Outgoing data
|
|
132
|
+
this._waitWindow = false; // SSH-level backpressure
|
|
133
|
+
|
|
134
|
+
// Incoming data
|
|
135
|
+
this._waitChanDrain = false; // Channel Readable side backpressure
|
|
136
|
+
|
|
137
|
+
this._chunk = undefined;
|
|
138
|
+
this._chunkcb = undefined;
|
|
139
|
+
this._chunkErr = undefined;
|
|
140
|
+
this._chunkcbErr = undefined;
|
|
141
|
+
|
|
142
|
+
this.on('finish', onFinish)
|
|
143
|
+
.on('prefinish', onFinish); // For node v0.11+
|
|
144
|
+
|
|
145
|
+
this.on('end', onEnd).on('close', onEnd);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
_read(n) {
|
|
149
|
+
if (this._waitChanDrain) {
|
|
150
|
+
this._waitChanDrain = false;
|
|
151
|
+
if (this.incoming.window <= WINDOW_THRESHOLD)
|
|
152
|
+
windowAdjust(this);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
_write(data, encoding, cb) {
|
|
157
|
+
const protocol = this._client._protocol;
|
|
158
|
+
const outgoing = this.outgoing;
|
|
159
|
+
const packetSize = outgoing.packetSize;
|
|
160
|
+
const id = outgoing.id;
|
|
161
|
+
let window = outgoing.window;
|
|
162
|
+
const len = data.length;
|
|
163
|
+
let p = 0;
|
|
164
|
+
|
|
165
|
+
if (outgoing.state !== 'open')
|
|
166
|
+
return;
|
|
167
|
+
|
|
168
|
+
while (len - p > 0 && window > 0) {
|
|
169
|
+
let sliceLen = len - p;
|
|
170
|
+
if (sliceLen > window)
|
|
171
|
+
sliceLen = window;
|
|
172
|
+
if (sliceLen > packetSize)
|
|
173
|
+
sliceLen = packetSize;
|
|
174
|
+
|
|
175
|
+
if (p === 0 && sliceLen === len)
|
|
176
|
+
protocol.channelData(id, data);
|
|
177
|
+
else
|
|
178
|
+
protocol.channelData(id, bufferSlice(data, p, p + sliceLen));
|
|
179
|
+
|
|
180
|
+
p += sliceLen;
|
|
181
|
+
window -= sliceLen;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
outgoing.window = window;
|
|
185
|
+
|
|
186
|
+
if (len - p > 0) {
|
|
187
|
+
if (window === 0)
|
|
188
|
+
this._waitWindow = true;
|
|
189
|
+
if (p > 0)
|
|
190
|
+
this._chunk = bufferSlice(data, p, len);
|
|
191
|
+
else
|
|
192
|
+
this._chunk = data;
|
|
193
|
+
this._chunkcb = cb;
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
cb();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
eof() {
|
|
201
|
+
if (this.outgoing.state === 'open') {
|
|
202
|
+
this.outgoing.state = 'eof';
|
|
203
|
+
this._client._protocol.channelEOF(this.outgoing.id);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
close() {
|
|
208
|
+
if (this.outgoing.state === 'open' || this.outgoing.state === 'eof') {
|
|
209
|
+
this.outgoing.state = 'closing';
|
|
210
|
+
this._client._protocol.channelClose(this.outgoing.id);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
destroy() {
|
|
215
|
+
this.end();
|
|
216
|
+
this.close();
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Session type-specific methods =============================================
|
|
221
|
+
setWindow(rows, cols, height, width) {
|
|
222
|
+
if (this.server)
|
|
223
|
+
throw new Error('Client-only method called in server mode');
|
|
224
|
+
|
|
225
|
+
if (this.type === 'session'
|
|
226
|
+
&& (this.subtype === 'shell' || this.subtype === 'exec')
|
|
227
|
+
&& this.writable
|
|
228
|
+
&& this.outgoing.state === 'open') {
|
|
229
|
+
this._client._protocol.windowChange(this.outgoing.id,
|
|
230
|
+
rows,
|
|
231
|
+
cols,
|
|
232
|
+
height,
|
|
233
|
+
width);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
signal(signalName) {
|
|
238
|
+
if (this.server)
|
|
239
|
+
throw new Error('Client-only method called in server mode');
|
|
240
|
+
|
|
241
|
+
if (this.type === 'session'
|
|
242
|
+
&& this.writable
|
|
243
|
+
&& this.outgoing.state === 'open') {
|
|
244
|
+
this._client._protocol.signal(this.outgoing.id, signalName);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
exit(statusOrSignal, coreDumped, msg) {
|
|
249
|
+
if (!this.server)
|
|
250
|
+
throw new Error('Server-only method called in client mode');
|
|
251
|
+
|
|
252
|
+
if (this.type === 'session'
|
|
253
|
+
&& this.writable
|
|
254
|
+
&& this.outgoing.state === 'open') {
|
|
255
|
+
if (typeof statusOrSignal === 'number') {
|
|
256
|
+
this._client._protocol.exitStatus(this.outgoing.id, statusOrSignal);
|
|
257
|
+
} else {
|
|
258
|
+
this._client._protocol.exitSignal(this.outgoing.id,
|
|
259
|
+
statusOrSignal,
|
|
260
|
+
coreDumped,
|
|
261
|
+
msg);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function onFinish() {
|
|
269
|
+
this.eof();
|
|
270
|
+
if (this.server || !this.allowHalfOpen)
|
|
271
|
+
this.close();
|
|
272
|
+
this.writable = false;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function onEnd() {
|
|
276
|
+
this.readable = false;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function windowAdjust(self) {
|
|
280
|
+
if (self.outgoing.state === 'closed')
|
|
281
|
+
return;
|
|
282
|
+
const amt = MAX_WINDOW - self.incoming.window;
|
|
283
|
+
if (amt <= 0)
|
|
284
|
+
return;
|
|
285
|
+
self.incoming.window += amt;
|
|
286
|
+
self._client._protocol.channelWindowAdjust(self.outgoing.id, amt);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
module.exports = {
|
|
290
|
+
Channel,
|
|
291
|
+
MAX_WINDOW,
|
|
292
|
+
PACKET_SIZE,
|
|
293
|
+
windowAdjust,
|
|
294
|
+
WINDOW_THRESHOLD,
|
|
295
|
+
};
|