Skip to content

Commit

Permalink
review: call proxy_on_vm_start() for all instances of the plugin.
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
  • Loading branch information
PiotrSikora committed Oct 26, 2020
1 parent 19601ee commit 0d30c87
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/wasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,18 @@ getOrCreateThreadLocalWasm(std::shared_ptr<WasmHandleBase> base_wasm,
WasmHandleCloneFactory clone_factory) {
auto wasm_handle = getThreadLocalWasm(base_wasm->wasm()->vm_key());
if (wasm_handle) {
auto root_context = wasm_handle->wasm()->getOrCreateRootContext(plugin);
if (!wasm_handle->wasm()->configure(root_context, plugin)) {
base_wasm->wasm()->fail(FailState::ConfigureFailed,
"Failed to configure thread-local Wasm code");
return nullptr;
auto root_context = wasm_handle->wasm()->getRootContext(plugin->key());
if (!root_context) {
root_context = wasm_handle->wasm()->start(plugin);
if (!root_context) {
base_wasm->wasm()->fail(FailState::StartFailed, "Failed to start thread-local Wasm");
return nullptr;
}
if (!wasm_handle->wasm()->configure(root_context, plugin)) {
base_wasm->wasm()->fail(FailState::ConfigureFailed,
"Failed to configure thread-local Wasm plugin");
return nullptr;
}
}
return wasm_handle;
}
Expand Down

0 comments on commit 0d30c87

Please sign in to comment.