Skip to content

Commit 8129a5a

Browse files
authored
Cleanup and document Context::onStart. (proxy-wasm#16)
Signed-off-by: John Plevyak <[email protected]>
1 parent dc21101 commit 8129a5a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/context.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,18 @@ std::string ContextBase::makeRootLogPrefix(string_view vm_id) const {
241241
//
242242
bool ContextBase::onStart(std::shared_ptr<PluginBase> plugin) {
243243
DeferAfterCallActions actions(this);
244-
bool result = 0;
244+
bool result = true;
245245
if (wasm_->on_context_create_) {
246246
plugin_ = plugin;
247247
wasm_->on_context_create_(this, id_, 0);
248248
plugin_.reset();
249249
}
250250
if (wasm_->on_vm_start_) {
251+
// Do not set plugin_ as the on_vm_start handler should be independent of the plugin since the
252+
// specific plugin which ends up calling it is not necessarily known by the Wasm module.
251253
result =
252254
wasm_->on_vm_start_(this, id_, static_cast<uint32_t>(wasm()->vm_configuration().size()))
253255
.u64_ != 0;
254-
plugin_.reset();
255256
}
256257
return result;
257258
}

0 commit comments

Comments
 (0)