Skip to content

Commit 0d30c87

Browse files
committed
review: call proxy_on_vm_start() for all instances of the plugin.
Signed-off-by: Piotr Sikora <[email protected]>
1 parent 19601ee commit 0d30c87

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/wasm.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,18 @@ getOrCreateThreadLocalWasm(std::shared_ptr<WasmHandleBase> base_wasm,
517517
WasmHandleCloneFactory clone_factory) {
518518
auto wasm_handle = getThreadLocalWasm(base_wasm->wasm()->vm_key());
519519
if (wasm_handle) {
520-
auto root_context = wasm_handle->wasm()->getOrCreateRootContext(plugin);
521-
if (!wasm_handle->wasm()->configure(root_context, plugin)) {
522-
base_wasm->wasm()->fail(FailState::ConfigureFailed,
523-
"Failed to configure thread-local Wasm code");
524-
return nullptr;
520+
auto root_context = wasm_handle->wasm()->getRootContext(plugin->key());
521+
if (!root_context) {
522+
root_context = wasm_handle->wasm()->start(plugin);
523+
if (!root_context) {
524+
base_wasm->wasm()->fail(FailState::StartFailed, "Failed to start thread-local Wasm");
525+
return nullptr;
526+
}
527+
if (!wasm_handle->wasm()->configure(root_context, plugin)) {
528+
base_wasm->wasm()->fail(FailState::ConfigureFailed,
529+
"Failed to configure thread-local Wasm plugin");
530+
return nullptr;
531+
}
525532
}
526533
return wasm_handle;
527534
}

0 commit comments

Comments
 (0)