Skip to content

Commit

Permalink
feat(vm) recognize new WASI reactors
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Jul 15, 2022
1 parent f386c51 commit c433954
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
5 changes: 4 additions & 1 deletion src/wasm/vm/ngx_wavm.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,10 @@ ngx_wavm_module_load(ngx_wavm_module_t *module)
ngx_wasm_sn_init(&funcref->sn, &funcref->name);
ngx_wasm_sn_rbtree_insert(&module->funcs_tree, &funcref->sn);

if (ngx_strncmp(exportname->data, "_start", 6) == 0) {
if (module->f_start == NULL
&& (ngx_strncmp(exportname->data, "_start", 6) == 0
|| ngx_strncmp(exportname->data, "_initialize", 11) == 0))
{
module->f_start = funcref;
}

Expand Down
19 changes: 9 additions & 10 deletions t/lib/proxy-wasm-tests/hostcalls/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ use std::collections::HashMap;
use std::time::Duration;
use url::Url;

proxy_wasm::main! {{
proxy_wasm::set_log_level(LogLevel::Trace);
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> {
Box::new(TestRoot {
config: HashMap::new(),
})
});
}}

#[derive(Debug, Eq, PartialEq, enum_utils::FromStr)]
#[enumeration(rename_all = "snake_case")]
enum TestPhase {
Expand Down Expand Up @@ -283,13 +292,3 @@ impl HttpContext for TestHttpHostcalls {
self.exec_tests(TestPhase::Log);
}
}

#[no_mangle]
pub fn _start() {
proxy_wasm::set_log_level(LogLevel::Trace);
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> {
Box::new(TestRoot {
config: HashMap::new(),
})
});
}

0 comments on commit c433954

Please sign in to comment.