You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, currently the function Server::run_server_on_runtime consumes the tokio::runtime::Runtime. This works fine with block set to true, but when block is set to false, the runtime gets dropped after Some(runtime.spawn(server_task)).
This is a problem, because "Shutting down the runtime is done by dropping the value" (see https://docs.rs/tokio/1.41.1/tokio/runtime/struct.Runtime.html#shutdown). I don't see a reason why the run_server_on_runtime method would need to consume the value, so passing in the runtime by reference would most likely work, but I think it would even be better to use a tokio::runtime::Handle, since this can also be obtained via Handle::current() when the runtime is created by tokio through #[tokio::main] instead of explicitly by the user.
The text was updated successfully, but these errors were encountered:
Hi, currently the function
Server::run_server_on_runtime
consumes thetokio::runtime::Runtime
. This works fine withblock
set to true, but whenblock
is set to false, the runtime gets dropped afterSome(runtime.spawn(server_task))
.opcua/lib/src/server/server.rs
Lines 250 to 266 in fcc89d8
This is a problem, because "Shutting down the runtime is done by dropping the value" (see https://docs.rs/tokio/1.41.1/tokio/runtime/struct.Runtime.html#shutdown). I don't see a reason why the run_server_on_runtime method would need to consume the value, so passing in the runtime by reference would most likely work, but I think it would even be better to use a
tokio::runtime::Handle
, since this can also be obtained via Handle::current() when the runtime is created by tokio through #[tokio::main] instead of explicitly by the user.The text was updated successfully, but these errors were encountered: