From e3f7aa8cb0437bb7231d2aeb89197bfe1e0150c1 Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Fri, 15 Aug 2025 14:55:08 -0600 Subject: [PATCH] Create async handle in RUNTIME --- ffi/src/core_device_proxy.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffi/src/core_device_proxy.rs b/ffi/src/core_device_proxy.rs index 8282681..c3928db 100644 --- a/ffi/src/core_device_proxy.rs +++ b/ffi/src/core_device_proxy.rs @@ -311,7 +311,10 @@ pub unsafe extern "C" fn core_device_proxy_create_tcp_adapter( match result { Ok(adapter_obj) => { - let boxed = Box::new(AdapterHandle(adapter_obj.to_async_handle())); + // We have to run this in the RUNTIME since we're spawning a new thread + let adapter_handle = RUNTIME.block_on(async move { adapter_obj.to_async_handle() }); + + let boxed = Box::new(AdapterHandle(adapter_handle)); unsafe { *adapter = Box::into_raw(boxed) }; null_mut() }