@@ -1092,6 +1092,10 @@ impl RunCommand {
10921092 ctx. ctx ( ) . table ,
10931093 )
10941094 } ) ?;
1095+ #[ cfg( feature = "component-model-async" ) ]
1096+ if self . run . common . wasi . p3 . unwrap_or ( crate :: common:: P3_DEFAULT ) {
1097+ wasmtime_wasi_tls:: p3:: add_to_linker ( linker) ?;
1098+ }
10951099
10961100 let ctx = wasmtime_wasi_tls:: WasiTlsCtxBuilder :: new ( ) . build ( ) ;
10971101 store. data_mut ( ) . wasi_tls = Some ( Arc :: new ( ctx) ) ;
@@ -1225,8 +1229,11 @@ pub struct Host {
12251229 wasi_http_outgoing_body_buffer_chunks : Option < usize > ,
12261230 #[ cfg( feature = "wasi-http" ) ]
12271231 wasi_http_outgoing_body_chunk_size : Option < usize > ,
1228- #[ cfg( all( feature = "wasi-http" , feature = "component-model-async" ) ) ]
1229- p3_http : crate :: common:: DefaultP3Ctx ,
1232+ #[ cfg( all(
1233+ any( feature = "wasi-http" , feature = "wasi-tls" ) ,
1234+ feature = "component-model-async"
1235+ ) ) ]
1236+ p3_ctx : crate :: common:: DefaultP3Ctx ,
12301237 limits : StoreLimits ,
12311238 #[ cfg( feature = "profiling" ) ]
12321239 guest_profiler : Option < Arc < wasmtime:: GuestProfiler > > ,
@@ -1286,7 +1293,17 @@ impl wasmtime_wasi_http::p3::WasiHttpView for Host {
12861293 fn http ( & mut self ) -> wasmtime_wasi_http:: p3:: WasiHttpCtxView < ' _ > {
12871294 wasmtime_wasi_http:: p3:: WasiHttpCtxView {
12881295 table : WasiView :: ctx ( unwrap_singlethread_context ( & mut self . wasip1_ctx ) ) . table ,
1289- ctx : & mut self . p3_http ,
1296+ ctx : & mut self . p3_ctx ,
1297+ }
1298+ }
1299+ }
1300+
1301+ #[ cfg( all( feature = "wasi-tls" , feature = "component-model-async" ) ) ]
1302+ impl wasmtime_wasi_tls:: p3:: WasiTlsView for Host {
1303+ fn tls ( & mut self ) -> wasmtime_wasi_tls:: p3:: WasiTlsCtxView < ' _ > {
1304+ wasmtime_wasi_tls:: p3:: WasiTlsCtxView {
1305+ table : WasiView :: ctx ( unwrap_singlethread_context ( & mut self . wasip1_ctx ) ) . table ,
1306+ ctx : & mut self . p3_ctx ,
12901307 }
12911308 }
12921309}
0 commit comments