@ai-ecoverse/slicc-kernel 1.154.3 → 1.155.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/README.md +1 -1
- package/dist/kernel-worker.js +30 -4
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +9 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +30 -4
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +9 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/kernel/socket-syscalls.d.ts +3 -0
- package/dist/types/kernel/socket.d.ts +6 -0
- package/dist/types/process/js/js-net.d.ts +1 -0
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -1895,8 +1895,8 @@ function link(a, b) {
|
|
|
1895
1895
|
pipe.openRead();
|
|
1896
1896
|
pipe.openWrite();
|
|
1897
1897
|
}
|
|
1898
|
-
a.attach({ rx: ba, tx: ab });
|
|
1899
|
-
b.attach({ rx: ab, tx: ba });
|
|
1898
|
+
a.attach({ rx: ba, tx: ab, peer: b });
|
|
1899
|
+
b.attach({ rx: ab, tx: ba, peer: a });
|
|
1900
1900
|
}
|
|
1901
1901
|
var SERVE_CHUNK = 64 * 1024;
|
|
1902
1902
|
var NEVER_ABORTED = new AbortController().signal;
|
|
@@ -1908,6 +1908,8 @@ var KernelSocket = class _KernelSocket {
|
|
|
1908
1908
|
dialing;
|
|
1909
1909
|
failed;
|
|
1910
1910
|
reset;
|
|
1911
|
+
abortive = false;
|
|
1912
|
+
refused;
|
|
1911
1913
|
local;
|
|
1912
1914
|
peer;
|
|
1913
1915
|
peerCred;
|
|
@@ -1944,20 +1946,25 @@ var KernelSocket = class _KernelSocket {
|
|
|
1944
1946
|
}
|
|
1945
1947
|
async read(max, signal) {
|
|
1946
1948
|
const { rx } = this.connection();
|
|
1949
|
+
if (this.refused) throw this.refused;
|
|
1947
1950
|
if (this.readShut || max <= 0) return new Uint8Array(0);
|
|
1948
1951
|
const bytes = await pipeCall(() => rx.read(max, signal));
|
|
1952
|
+
if (this.refused) throw this.refused;
|
|
1949
1953
|
if (bytes.length === 0 && this.reset) throw this.reset;
|
|
1950
1954
|
return bytes;
|
|
1951
1955
|
}
|
|
1952
1956
|
async peek(max, signal) {
|
|
1953
1957
|
const { rx } = this.connection();
|
|
1958
|
+
if (this.refused) throw this.refused;
|
|
1954
1959
|
if (this.readShut || max <= 0) return new Uint8Array(0);
|
|
1955
1960
|
const bytes = await pipeCall(() => rx.peek(max, signal));
|
|
1961
|
+
if (this.refused) throw this.refused;
|
|
1956
1962
|
if (bytes.length === 0 && this.reset) throw this.reset;
|
|
1957
1963
|
return bytes;
|
|
1958
1964
|
}
|
|
1959
1965
|
async write(bytes, signal) {
|
|
1960
1966
|
const { tx } = this.connection();
|
|
1967
|
+
if (this.refused) throw this.refused;
|
|
1961
1968
|
if (this.writeShut) throw new KernelError("EPIPE");
|
|
1962
1969
|
if (this.reset?.code === "EPROTO") throw this.reset;
|
|
1963
1970
|
return pipeCall(() => tx.write(bytes, signal));
|
|
@@ -2144,10 +2151,11 @@ var KernelSocket = class _KernelSocket {
|
|
|
2144
2151
|
handshaking = false;
|
|
2145
2152
|
signal.removeEventListener("abort", abandon);
|
|
2146
2153
|
}
|
|
2147
|
-
|
|
2154
|
+
const plain3 = uplinkLink(made2.conn, (err) => {
|
|
2148
2155
|
this.reset = err instanceof KernelError && err.code === "EPROTO" ? err : new KernelError("ECONNRESET");
|
|
2149
2156
|
this.changes.wake();
|
|
2150
2157
|
});
|
|
2158
|
+
this.link = { ...plain3, ...raw2.peer ? { peer: raw2.peer } : {} };
|
|
2151
2159
|
this.changes.wake();
|
|
2152
2160
|
return made2.info;
|
|
2153
2161
|
}
|
|
@@ -2265,8 +2273,22 @@ var KernelSocket = class _KernelSocket {
|
|
|
2265
2273
|
setOption(level, name2, value2) {
|
|
2266
2274
|
this.options.set(`${level}:${name2}`, value2);
|
|
2267
2275
|
}
|
|
2276
|
+
resetOnClose() {
|
|
2277
|
+
this.connection();
|
|
2278
|
+
this.abortive = true;
|
|
2279
|
+
}
|
|
2280
|
+
abort() {
|
|
2281
|
+
const link2 = this.link;
|
|
2282
|
+
if (link2.peer) link2.peer.resetBy();
|
|
2283
|
+
else link2.tx.closeRead();
|
|
2284
|
+
}
|
|
2285
|
+
resetBy() {
|
|
2286
|
+
this.refused ??= new KernelError("ECONNRESET");
|
|
2287
|
+
this.changes.wake();
|
|
2288
|
+
}
|
|
2268
2289
|
close() {
|
|
2269
2290
|
const was = this.state;
|
|
2291
|
+
if (this.abortive && was === "connected") this.abort();
|
|
2270
2292
|
this.state = "closed";
|
|
2271
2293
|
this.dialing?.abort(new KernelError("ECONNABORTED"));
|
|
2272
2294
|
this.dialing = void 0;
|
|
@@ -3566,7 +3588,7 @@ function satisfies(version, range2) {
|
|
|
3566
3588
|
}
|
|
3567
3589
|
|
|
3568
3590
|
// src/version.ts
|
|
3569
|
-
var KERNEL_VERSION = true ? "1.
|
|
3591
|
+
var KERNEL_VERSION = true ? "1.155.0" : "0.0.0-dev";
|
|
3570
3592
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3571
3593
|
function procVersion() {
|
|
3572
3594
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -19188,6 +19210,7 @@ var SOCKET_OPS = [
|
|
|
19188
19210
|
"sock-accept",
|
|
19189
19211
|
"sock-connect",
|
|
19190
19212
|
"sock-shutdown",
|
|
19213
|
+
"sock-reset",
|
|
19191
19214
|
"sock-name",
|
|
19192
19215
|
"sock-getopt",
|
|
19193
19216
|
"sock-setopt",
|
|
@@ -19255,6 +19278,9 @@ async function socketSyscall(req, proc) {
|
|
|
19255
19278
|
case "sock-shutdown":
|
|
19256
19279
|
anySocketAt(fds, req.fd).shutdown(req.how);
|
|
19257
19280
|
return ok3();
|
|
19281
|
+
case "sock-reset":
|
|
19282
|
+
socketAt(fds, req.fd).resetOnClose();
|
|
19283
|
+
return ok3();
|
|
19258
19284
|
case "sock-name": {
|
|
19259
19285
|
const socket = anySocketAt(fds, req.fd);
|
|
19260
19286
|
const addr = req.peer ? socket.peer : socket.local;
|