justrun-ws 0.2.2 → 0.3.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/lib/JustRunAuthProvider.js +242 -0
- package/lib/WsClient.js +72 -159
- package/lib/bundle.min.js +1 -1
- package/lib/common/AdjustableTimer.js +17 -17
- package/lib/common/DataWrapper.js +12 -12
- package/lib/common/List.js +27 -27
- package/lib/common/utils.js +10 -10
- package/lib/handler/SimpleHandler.js +31 -31
- package/lib/index.d.ts +43 -20
- package/lib/index.js +1 -0
- package/lib/net/BrowserWsNet.js +47 -47
- package/lib/net/LazyConn.js +23 -23
- package/lib/net/NetErrorString.js +7 -7
- package/lib/net/PackageWrapper.js +12 -12
- package/lib/net/TimeoutMonitor.js +32 -32
- package/lib/net/TypedPkgHub.js +164 -174
- package/lib/net/hubPkgSerializer.js +2 -2
- package/package.json +2 -2
|
@@ -46,26 +46,26 @@ class RequestWrapper extends PkgWrapper {
|
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
48
|
get resp() {
|
|
49
|
-
if (!this.
|
|
50
|
-
this.
|
|
49
|
+
if (!this.B) {
|
|
50
|
+
this.B = this.decodeResponse(this.C);
|
|
51
51
|
}
|
|
52
|
-
return this.
|
|
52
|
+
return this.B;
|
|
53
53
|
}
|
|
54
54
|
set resp(b) {
|
|
55
|
-
this.
|
|
56
|
-
this
|
|
55
|
+
this.B = b;
|
|
56
|
+
this.C = undefined;
|
|
57
57
|
}
|
|
58
58
|
get respBuff() {
|
|
59
|
-
if (!this
|
|
60
|
-
this
|
|
59
|
+
if (!this.C) {
|
|
60
|
+
this.C = this.encodeResponse(this.B);
|
|
61
61
|
}
|
|
62
|
-
return this
|
|
62
|
+
return this.C;
|
|
63
63
|
}
|
|
64
64
|
set respBuff(b) {
|
|
65
|
-
this.
|
|
66
|
-
this
|
|
65
|
+
this.B = undefined;
|
|
66
|
+
this.C = b;
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
B;
|
|
69
|
+
C;
|
|
70
70
|
}
|
|
71
71
|
//# sourceMappingURL=PackageWrapper.js.map
|
|
@@ -3,14 +3,14 @@ import { l } from '../common/utils';
|
|
|
3
3
|
export class MonitorConn extends ListNode {
|
|
4
4
|
}
|
|
5
5
|
export class TimeoutMonitor {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
6
|
+
constructor(f, h, g) {
|
|
7
|
+
this.a0 = f;
|
|
8
|
+
this.O = h;
|
|
9
|
+
this.I = g;
|
|
10
|
+
this.p = 0;
|
|
11
|
+
this.J = 0;
|
|
12
12
|
this.r = [];
|
|
13
|
-
if (
|
|
13
|
+
if (f === 0) {
|
|
14
14
|
this.insert = l;
|
|
15
15
|
this.update = l;
|
|
16
16
|
this.remove = l;
|
|
@@ -21,50 +21,50 @@ export class TimeoutMonitor {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
insert(conn) {
|
|
24
|
-
if (!this.
|
|
25
|
-
this.
|
|
24
|
+
if (!this.J) {
|
|
25
|
+
this.a1 = setInterval(this.ab, this.a0);
|
|
26
26
|
}
|
|
27
|
-
this.
|
|
28
|
-
this.r[this.
|
|
27
|
+
this.J++;
|
|
28
|
+
this.r[this.p].Z(conn);
|
|
29
29
|
}
|
|
30
30
|
update(conn) {
|
|
31
31
|
conn.remove();
|
|
32
|
-
this.r[this.
|
|
32
|
+
this.r[this.p].Z(conn);
|
|
33
33
|
}
|
|
34
34
|
remove(conn) {
|
|
35
35
|
conn.remove();
|
|
36
|
-
this.
|
|
37
|
-
if (!this.
|
|
38
|
-
clearInterval(this.
|
|
36
|
+
this.J--;
|
|
37
|
+
if (!this.J) {
|
|
38
|
+
clearInterval(this.a1);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
this.
|
|
44
|
-
if (this.
|
|
45
|
-
this.
|
|
41
|
+
ab = () => {
|
|
42
|
+
const { O, I, r } = this;
|
|
43
|
+
this.p++;
|
|
44
|
+
if (this.p === I) {
|
|
45
|
+
this.p = 0;
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
48
|
-
let d = this.
|
|
49
|
-
if (d >=
|
|
50
|
-
d -=
|
|
47
|
+
if (O) {
|
|
48
|
+
let d = this.p + O;
|
|
49
|
+
if (d >= I) {
|
|
50
|
+
d -= I;
|
|
51
51
|
}
|
|
52
52
|
const b = r[d];
|
|
53
|
-
for (let node = b.
|
|
53
|
+
for (let node = b.e; !b.Y(node); node = node.getNext()) {
|
|
54
54
|
node.keepAlive();
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const b = r[this.
|
|
58
|
-
for (let node = b.
|
|
57
|
+
const b = r[this.p];
|
|
58
|
+
for (let node = b.e; !b.Y(node); node = node.getNext()) {
|
|
59
59
|
node.timeout();
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
a0;
|
|
63
|
+
O;
|
|
63
64
|
I;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
S;
|
|
65
|
+
p;
|
|
66
|
+
J;
|
|
67
|
+
a1;
|
|
68
68
|
r;
|
|
69
69
|
}
|
|
70
70
|
//# sourceMappingURL=TimeoutMonitor.js.map
|
package/lib/net/TypedPkgHub.js
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z, l } from '../common/utils';
|
|
2
2
|
import { NetErrorString } from './NetErrorString';
|
|
3
3
|
import { MonitorConn } from './TimeoutMonitor';
|
|
4
|
-
export class
|
|
5
|
-
constructor(
|
|
6
|
-
const { responsePkgType, timeoutMonitor, makePkgBuff, parsePkgBuff } =
|
|
4
|
+
export class u {
|
|
5
|
+
constructor(B, v) {
|
|
6
|
+
const { responsePkgType, timeoutMonitor, makePkgBuff, parsePkgBuff } = v;
|
|
7
7
|
this.responsePkgType = responsePkgType;
|
|
8
8
|
this.s = 0;
|
|
9
9
|
this.t = new Map();
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
10
|
+
this.h = new Map();
|
|
11
|
+
this.T = new Map();
|
|
12
|
+
this.a2 = makePkgBuff;
|
|
13
|
+
this.a3 = parsePkgBuff;
|
|
14
|
+
this.E = B;
|
|
15
|
+
this.P = timeoutMonitor;
|
|
16
|
+
const M = this;
|
|
17
|
+
M.y = this.ac;
|
|
18
|
+
const r = [];
|
|
19
|
+
this.a2(responsePkgType, 0x200000, r);
|
|
20
|
+
this.a4 = {
|
|
21
21
|
makePkgBuff: makePkgBuff,
|
|
22
22
|
responsePkgType: responsePkgType,
|
|
23
|
-
|
|
23
|
+
r: z(r),
|
|
24
24
|
};
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
25
|
+
this.h.set(responsePkgType, M);
|
|
26
|
+
this.E.I((c, p) => {
|
|
27
27
|
do {
|
|
28
28
|
this.s++;
|
|
29
29
|
} while (this.t.has(this.s & 0x1fffff));
|
|
30
|
-
const conn = new
|
|
30
|
+
const conn = new w(this.a4, c, this.s & 0x1fffff);
|
|
31
31
|
this.t.set(conn.id, conn);
|
|
32
|
-
this.
|
|
32
|
+
this.P?.insert(conn);
|
|
33
33
|
const g = {
|
|
34
34
|
conn,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
A: (buff) => this.ad(conn, buff),
|
|
36
|
+
o: (err) => this.ae(conn, err),
|
|
37
37
|
};
|
|
38
|
-
this.
|
|
38
|
+
this.Q?.(this, conn, !!p);
|
|
39
39
|
return g;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
responsePkgType;
|
|
43
43
|
context;
|
|
44
|
+
Q;
|
|
44
45
|
K;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return this.A.o();
|
|
46
|
+
b() {
|
|
47
|
+
return this.E.b();
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
return this.t.get(
|
|
49
|
+
S(x) {
|
|
50
|
+
return this.t.get(x);
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
return this.
|
|
52
|
+
d(e) {
|
|
53
|
+
return this.E.d(e);
|
|
54
54
|
}
|
|
55
|
-
async
|
|
55
|
+
async V() {
|
|
56
56
|
do {
|
|
57
57
|
this.s++;
|
|
58
58
|
} while (this.t.has(this.s & 0x1fffff));
|
|
59
|
-
const conn = new
|
|
59
|
+
const conn = new a0(this.s & 0x1fffff, this);
|
|
60
60
|
this.t.set(conn.id, conn);
|
|
61
61
|
return conn;
|
|
62
62
|
}
|
|
63
|
-
async
|
|
64
|
-
return this.
|
|
63
|
+
async W(e) {
|
|
64
|
+
return this.E.J(e);
|
|
65
65
|
}
|
|
66
|
-
async
|
|
67
|
-
return this.
|
|
66
|
+
async X() {
|
|
67
|
+
return this.E.L();
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
af(conn, message) {
|
|
70
70
|
const pkgType = message.constructor.pkgType;
|
|
71
|
-
const handler = this.
|
|
71
|
+
const handler = this.h.get(pkgType);
|
|
72
72
|
if (handler) {
|
|
73
|
-
return handler?.
|
|
73
|
+
return handler?.q(conn, message);
|
|
74
74
|
}
|
|
75
|
-
throw new Error(NetErrorString
|
|
75
|
+
throw new Error(NetErrorString.$);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
ag(conn, request) {
|
|
78
78
|
const pkgType = request.constructor.pkgType;
|
|
79
|
-
const handler = this.
|
|
79
|
+
const handler = this.h.get(pkgType);
|
|
80
80
|
if (handler) {
|
|
81
|
-
return handler?.
|
|
81
|
+
return handler?.q(conn, request);
|
|
82
82
|
}
|
|
83
|
-
throw new Error(NetErrorString
|
|
83
|
+
throw new Error(NetErrorString.$);
|
|
84
84
|
}
|
|
85
85
|
registerError(pkgType, wrapperCtor) {
|
|
86
86
|
wrapperCtor.registerPkgType(pkgType);
|
|
87
|
-
this.
|
|
88
|
-
const
|
|
89
|
-
this.
|
|
87
|
+
this.T.set(pkgType, wrapperCtor);
|
|
88
|
+
const a1 = this.h.get(this.responsePkgType);
|
|
89
|
+
this.h.set(pkgType, a1);
|
|
90
90
|
}
|
|
91
91
|
registerMessage(pkgType, wrapperCtor) {
|
|
92
92
|
wrapperCtor.registerPkgType(pkgType);
|
|
@@ -97,221 +97,211 @@ export class v {
|
|
|
97
97
|
handleMessageWith(handler) {
|
|
98
98
|
const pkgType = handler.pkgType;
|
|
99
99
|
if (typeof pkgType !== typeof this.responsePkgType) {
|
|
100
|
-
throw new Error(`Wrapper ${handler.
|
|
100
|
+
throw new Error(`Wrapper ${handler.k} has an incompatible pkgType ${typeof pkgType}`);
|
|
101
101
|
}
|
|
102
|
-
if (this.
|
|
103
|
-
throw new Error(`Wrapper ${handler.
|
|
102
|
+
if (this.h.has(pkgType)) {
|
|
103
|
+
throw new Error(`Wrapper ${handler.k} is already handled by another handler`);
|
|
104
104
|
}
|
|
105
|
-
this.
|
|
105
|
+
this.h.set(pkgType, handler);
|
|
106
106
|
return handler;
|
|
107
107
|
}
|
|
108
108
|
handleRequestWith(handler) {
|
|
109
109
|
const pkgType = handler.pkgType;
|
|
110
110
|
if (typeof pkgType !== typeof this.responsePkgType) {
|
|
111
|
-
throw new Error(`Wrapper ${handler.
|
|
111
|
+
throw new Error(`Wrapper ${handler.k} has an incompatible pkgType ${typeof pkgType}`);
|
|
112
112
|
}
|
|
113
|
-
if (this.
|
|
114
|
-
throw new Error(`Wrapper ${handler.
|
|
113
|
+
if (this.h.has(pkgType)) {
|
|
114
|
+
throw new Error(`Wrapper ${handler.k} is already handled by another handler`);
|
|
115
115
|
}
|
|
116
|
-
this.
|
|
116
|
+
this.h.set(pkgType, handler);
|
|
117
117
|
return handler;
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
at(handler) {
|
|
120
120
|
const pkgType = handler.pkgType;
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
123
|
-
this.
|
|
121
|
+
const a8 = this.h.get(pkgType);
|
|
122
|
+
if (a8 === handler) {
|
|
123
|
+
this.h.delete(pkgType);
|
|
124
124
|
return true;
|
|
125
125
|
}
|
|
126
126
|
return false;
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
const a = this.
|
|
131
|
-
const handler = this.
|
|
128
|
+
ad(conn, buff) {
|
|
129
|
+
this.P?.update(conn);
|
|
130
|
+
const a = this.a3(buff);
|
|
131
|
+
const handler = this.h.get(a.pkgType);
|
|
132
132
|
if (handler) {
|
|
133
|
-
handler
|
|
133
|
+
handler.y(conn, a);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
conn.close(new Error(NetErrorString
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
this.t.delete(
|
|
141
|
-
this.
|
|
142
|
-
conn.
|
|
143
|
-
this.
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
136
|
+
conn.close(new Error(NetErrorString.$));
|
|
137
|
+
}
|
|
138
|
+
ae(conn, err) {
|
|
139
|
+
const x = conn.id;
|
|
140
|
+
this.t.delete(x);
|
|
141
|
+
this.P?.remove(conn);
|
|
142
|
+
conn.o(err);
|
|
143
|
+
this.K?.(this, conn, conn.c.G(), err);
|
|
144
|
+
}
|
|
145
|
+
ac(conn, a) {
|
|
146
|
+
try {
|
|
147
|
+
const { buff, pkgType, requestId, bodyOffset } = a;
|
|
148
|
+
if (pkgType === this.responsePkgType) {
|
|
149
|
+
const body = buff.subarray(bodyOffset);
|
|
150
|
+
conn.a5(requestId, body);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
const R = this.T.get(pkgType);
|
|
154
|
+
if (R) {
|
|
155
|
+
const body = buff.subarray(bodyOffset);
|
|
156
|
+
const a9 = new R(body, true);
|
|
157
|
+
conn.ah(requestId, a9);
|
|
158
|
+
}
|
|
157
159
|
}
|
|
158
160
|
}
|
|
161
|
+
catch {
|
|
162
|
+
conn.close(new Error(NetErrorString.$));
|
|
163
|
+
}
|
|
159
164
|
}
|
|
160
|
-
|
|
165
|
+
a4;
|
|
161
166
|
s;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
a2;
|
|
168
|
+
a3;
|
|
169
|
+
E;
|
|
165
170
|
t;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
h;
|
|
172
|
+
T;
|
|
173
|
+
P;
|
|
169
174
|
}
|
|
170
|
-
class
|
|
171
|
-
constructor(
|
|
175
|
+
class w extends MonitorConn {
|
|
176
|
+
constructor(v, c, id) {
|
|
172
177
|
super();
|
|
173
178
|
this.id = id;
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
179
|
+
this.c = c;
|
|
180
|
+
this.F = v;
|
|
181
|
+
this.a6 = 0;
|
|
177
182
|
}
|
|
178
183
|
context;
|
|
179
184
|
id;
|
|
180
|
-
|
|
181
|
-
get
|
|
182
|
-
return this.
|
|
183
|
-
}
|
|
184
|
-
get localPort() {
|
|
185
|
-
return this.b.localPort;
|
|
186
|
-
}
|
|
187
|
-
get remoteAddress() {
|
|
188
|
-
return this.b.remoteAddress;
|
|
189
|
-
}
|
|
190
|
-
get remoteFamily() {
|
|
191
|
-
return this.b.remoteFamily;
|
|
192
|
-
}
|
|
193
|
-
get remotePort() {
|
|
194
|
-
return this.b.remotePort;
|
|
185
|
+
c;
|
|
186
|
+
get socket() {
|
|
187
|
+
return this.c.socket;
|
|
195
188
|
}
|
|
196
189
|
sendMessage(message) {
|
|
197
190
|
const pkgType = message.constructor.pkgType;
|
|
198
191
|
const encoded = [message.buff];
|
|
199
|
-
this.
|
|
200
|
-
return this.
|
|
192
|
+
this.F.makePkgBuff(pkgType, 0, encoded);
|
|
193
|
+
return this.c.n(encoded);
|
|
201
194
|
}
|
|
202
195
|
sendRequest(request) {
|
|
203
|
-
this.
|
|
204
|
-
this.sendRequest = this.
|
|
205
|
-
this.
|
|
206
|
-
this.
|
|
207
|
-
return this.
|
|
196
|
+
this.m = new Map();
|
|
197
|
+
this.sendRequest = this.a7;
|
|
198
|
+
this.a5 = this.ai;
|
|
199
|
+
this.o = this.aj;
|
|
200
|
+
return this.a7(request);
|
|
208
201
|
}
|
|
209
202
|
sendErrorResponse(error, requestId) {
|
|
210
203
|
const pkgType = error.constructor.pkgType;
|
|
211
204
|
const encoded = [error.buff];
|
|
212
|
-
this.
|
|
213
|
-
return this.
|
|
205
|
+
this.F.makePkgBuff(pkgType, requestId, encoded);
|
|
206
|
+
return this.c.n(encoded);
|
|
214
207
|
}
|
|
215
208
|
sendResponse(request, requestId) {
|
|
216
209
|
const encoded = [request.respBuff];
|
|
217
|
-
const { makePkgBuff, responsePkgType } = this.
|
|
210
|
+
const { makePkgBuff, responsePkgType } = this.F;
|
|
218
211
|
makePkgBuff(responsePkgType, requestId, encoded);
|
|
219
|
-
return this.
|
|
212
|
+
return this.c.n(encoded);
|
|
220
213
|
}
|
|
221
214
|
async close(err) {
|
|
222
|
-
await this.
|
|
215
|
+
await this.c.close(err);
|
|
223
216
|
}
|
|
224
|
-
|
|
217
|
+
a5(requestId, an) {
|
|
225
218
|
if (requestId === 0x200000 && this.context === undefined) {
|
|
226
|
-
this.close(new Error(NetErrorString.
|
|
219
|
+
this.close(new Error(NetErrorString.H));
|
|
227
220
|
}
|
|
228
221
|
}
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
232
|
-
this.
|
|
233
|
-
return j
|
|
222
|
+
ah(requestId, error) {
|
|
223
|
+
const i = this.m.get(requestId);
|
|
224
|
+
if (i) {
|
|
225
|
+
this.m.delete(requestId);
|
|
226
|
+
return i.j(error);
|
|
234
227
|
}
|
|
235
228
|
}
|
|
236
229
|
keepAlive() {
|
|
237
|
-
this.
|
|
230
|
+
this.c.D(this.F.r).catch(l);
|
|
238
231
|
}
|
|
239
232
|
timeout() {
|
|
240
|
-
this.close(new Error(NetErrorString.
|
|
233
|
+
this.close(new Error(NetErrorString.Z));
|
|
241
234
|
}
|
|
242
|
-
|
|
235
|
+
o(aa) {
|
|
243
236
|
}
|
|
244
|
-
async
|
|
245
|
-
const requestId = (this.
|
|
237
|
+
async a7(request) {
|
|
238
|
+
const requestId = (this.a6++) & 0x1fffff;
|
|
246
239
|
const pkgType = request.constructor.pkgType;
|
|
247
240
|
const encoded = [request.buff];
|
|
248
|
-
this.
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
this.
|
|
252
|
-
this.
|
|
253
|
-
this.
|
|
254
|
-
|
|
241
|
+
this.F.makePkgBuff(pkgType, requestId, encoded);
|
|
242
|
+
const ab = new Promise((f, j) => {
|
|
243
|
+
const ak = { f, j };
|
|
244
|
+
this.m.set(requestId, ak);
|
|
245
|
+
this.c.n(encoded).catch((err) => {
|
|
246
|
+
this.m.delete(requestId);
|
|
247
|
+
j(err);
|
|
255
248
|
});
|
|
256
249
|
});
|
|
257
|
-
request.respBuff = await
|
|
250
|
+
request.respBuff = await ab;
|
|
258
251
|
}
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
this.
|
|
263
|
-
|
|
252
|
+
ai(requestId, body) {
|
|
253
|
+
const i = this.m.get(requestId);
|
|
254
|
+
if (i) {
|
|
255
|
+
this.m.delete(requestId);
|
|
256
|
+
i.f(body);
|
|
264
257
|
return;
|
|
265
258
|
}
|
|
266
259
|
if (requestId === 0x200000 && this.context === undefined) {
|
|
267
|
-
this.close(new Error(NetErrorString.
|
|
260
|
+
this.close(new Error(NetErrorString.H));
|
|
268
261
|
}
|
|
269
262
|
}
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
263
|
+
aj(err) {
|
|
264
|
+
const C = this.m;
|
|
265
|
+
if (C.size > 0) {
|
|
273
266
|
if (!err) {
|
|
274
|
-
err = new Error(NetErrorString.
|
|
267
|
+
err = new Error(NetErrorString.Y);
|
|
275
268
|
}
|
|
276
|
-
for (const [requestId,
|
|
277
|
-
|
|
278
|
-
j
|
|
269
|
+
for (const [requestId, i] of C) {
|
|
270
|
+
C.delete(requestId);
|
|
271
|
+
i.j(err);
|
|
279
272
|
}
|
|
280
273
|
}
|
|
281
|
-
this.
|
|
274
|
+
this.m = undefined;
|
|
282
275
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
276
|
+
F;
|
|
277
|
+
m;
|
|
278
|
+
a6;
|
|
286
279
|
}
|
|
287
|
-
class
|
|
288
|
-
constructor(id,
|
|
280
|
+
class a0 {
|
|
281
|
+
constructor(id, al) {
|
|
289
282
|
this.id = id;
|
|
290
|
-
this.
|
|
283
|
+
this.U = al;
|
|
291
284
|
}
|
|
292
285
|
context;
|
|
293
286
|
id;
|
|
294
|
-
|
|
295
|
-
localPort;
|
|
296
|
-
remoteAddress;
|
|
297
|
-
remotePort;
|
|
287
|
+
socket;
|
|
298
288
|
get remoteFamily() {
|
|
299
289
|
return 'Local';
|
|
300
290
|
}
|
|
301
291
|
async sendMessage(message) {
|
|
302
|
-
return this.
|
|
292
|
+
return this.U.af(this, message);
|
|
303
293
|
}
|
|
304
294
|
async sendRequest(request) {
|
|
305
|
-
return this.
|
|
295
|
+
return this.U.ag(this, request);
|
|
306
296
|
}
|
|
307
|
-
sendErrorResponse(
|
|
297
|
+
sendErrorResponse(ao, am) {
|
|
308
298
|
throw null;
|
|
309
299
|
}
|
|
310
|
-
sendResponse(
|
|
300
|
+
sendResponse(ap, am) {
|
|
311
301
|
throw null;
|
|
312
302
|
}
|
|
313
|
-
async close(
|
|
303
|
+
async close(aa) {
|
|
314
304
|
}
|
|
315
|
-
|
|
305
|
+
U;
|
|
316
306
|
}
|
|
317
307
|
//# sourceMappingURL=TypedPkgHub.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j, l, m } from '../common/varUintOps';
|
|
2
|
-
export const
|
|
2
|
+
export const n = (pkgType, requestId, encoded) => {
|
|
3
3
|
const i = [requestId, pkgType];
|
|
4
4
|
const b = j(i);
|
|
5
5
|
const a = new Uint8Array(b);
|
|
6
6
|
m(i, a);
|
|
7
7
|
encoded.push(a);
|
|
8
8
|
};
|
|
9
|
-
export const
|
|
9
|
+
export const o = (buff) => {
|
|
10
10
|
const { h: [requestId, pkgType], k: bodyOffset } = l(2, buff);
|
|
11
11
|
const result = { buff, pkgType, requestId, bodyOffset };
|
|
12
12
|
return result;
|