smoldot 2.0.2 → 2.0.3
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/dist/cjs/internals/bytecode/wasm0.js +1 -1
- package/dist/cjs/internals/bytecode/wasm1.js +1 -1
- package/dist/cjs/internals/bytecode/wasm2.js +1 -1
- package/dist/cjs/internals/client.js +7 -4
- package/dist/cjs/public-types.d.ts +13 -5
- package/dist/mjs/internals/bytecode/wasm0.js +1 -1
- package/dist/mjs/internals/bytecode/wasm1.js +1 -1
- package/dist/mjs/internals/bytecode/wasm2.js +1 -1
- package/dist/mjs/internals/client.js +7 -4
- package/dist/mjs/public-types.d.ts +13 -5
- package/package.json +1 -1
|
@@ -360,11 +360,16 @@ export function start(options, wasmModule, platformBindings) {
|
|
|
360
360
|
if (state.instance.status !== "ready")
|
|
361
361
|
throw new Error(); // Internal error. Never supposed to happen.
|
|
362
362
|
state.instance.instance.shutdownExecutor();
|
|
363
|
-
|
|
363
|
+
// Wait for the `executor-shutdown` event to be generated.
|
|
364
|
+
yield new Promise((resolve) => state.onExecutorShutdownOrWasmPanic = resolve);
|
|
365
|
+
// In case the instance crashes while we were waiting, we don't want to overwrite
|
|
366
|
+
// the error.
|
|
367
|
+
if (state.instance.status === "ready")
|
|
368
|
+
state.instance = { status: "destroyed", error: new AlreadyDestroyedError() };
|
|
364
369
|
state.connections.forEach((connec) => connec.reset());
|
|
365
370
|
state.connections.clear();
|
|
366
371
|
for (const addChainResult of state.addChainResults) {
|
|
367
|
-
addChainResult({ success: false, error: "
|
|
372
|
+
addChainResult({ success: false, error: "Client.terminate() has been called" });
|
|
368
373
|
}
|
|
369
374
|
state.addChainResults = [];
|
|
370
375
|
for (const chain of Array.from(state.chains.values())) {
|
|
@@ -374,8 +379,6 @@ export function start(options, wasmModule, platformBindings) {
|
|
|
374
379
|
chain.jsonRpcResponsesPromises = [];
|
|
375
380
|
}
|
|
376
381
|
state.chains.clear();
|
|
377
|
-
// Wait for the `executor-shutdown` event to be generated.
|
|
378
|
-
yield new Promise((resolve) => state.onExecutorShutdownOrWasmPanic = resolve);
|
|
379
382
|
})
|
|
380
383
|
};
|
|
381
384
|
}
|
|
@@ -142,12 +142,20 @@ export interface Chain {
|
|
|
142
142
|
* The JSON-RPC callback will no longer be called. This is the case immediately after this
|
|
143
143
|
* function is called. Any on-going JSON-RPC request is instantaneously aborted.
|
|
144
144
|
*
|
|
145
|
-
* Trying to use the chain again will lead to
|
|
145
|
+
* Trying to use the chain again will lead to a {@link AlreadyDestroyedError} exception
|
|
146
|
+
* being thrown.
|
|
146
147
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
148
|
+
* While the chain instantaneously disappears from the public API as soon as this function is
|
|
149
|
+
* called, its shutdown process actually happens asynchronously in the background. This means
|
|
150
|
+
* for example that networking connections to the chain will remain open for a little bit even
|
|
151
|
+
* after this function returns.
|
|
152
|
+
*
|
|
153
|
+
* If the chain is a relay chain, and that there exists {@link Chain} instances corresponding
|
|
154
|
+
* to parachains that are using this relay chain, then these parachains will continue to work
|
|
155
|
+
* and the relay chain will actually remain connected in the background.
|
|
156
|
+
* Smoldot automatically keeps alive all relay chains that have an active parachains. There
|
|
157
|
+
* is no need to track parachains and relay chains, or to destroy them in the correct order,
|
|
158
|
+
* as this is handled automatically internally.
|
|
151
159
|
*
|
|
152
160
|
* @throws {@link AlreadyDestroyedError} If the chain has already been removed or the client has been terminated.
|
|
153
161
|
* @throws {@link CrashError} If the background client has crashed.
|