If channels are setup, it is no longer possible to send regular packets. Since the send method uses the sender which has been moved when building channels, it causes panic trying to unwrap None.
Due to this bug we can not use built-in heartbeat feature along with channels.
Steps to reproduce
Create bevy project
Add NetworkingPlugin with auto_heartbeat_ms: Some(1000)
Setup message channels
Run server
Connect client to server
Possible solution
Create separate senders for packets and messages.
Backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_networking_turbulence-0.3.3/src/transport.rs:282:14
stack backtrace:
0: rust_begin_unwind
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:92:14
2: core::panicking::panic
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:50:5
3: core::option::Option<T>::unwrap
at /home/vigdail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:386:21
4: <bevy_networking_turbulence::transport::ClientConnection as bevy_networking_turbulence::transport::Connection>::send
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_networking_turbulence-0.3.3/src/transport.rs:280:9
5: bevy_networking_turbulence::NetworkResource::send
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_networking_turbulence-0.3.3/src/lib.rs:379:33
6: bevy_networking_turbulence::heartbeats_and_timeouts
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_networking_turbulence-0.3.3/src/lib.rs:473:9
7: core::ops::function::Fn::call
at /home/vigdail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:70:5
8: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
at /home/vigdail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:247:13
9: <Func as bevy_ecs::system::into_system::SystemParamFunction<(),Out,(F0,F1),()>>::run
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.5.0/src/system/into_system.rs:207:21
10: <bevy_ecs::system::into_system::FunctionSystem<In,Out,Param,Marker,F> as bevy_ecs::system::system::System>::run_unsafe
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.5.0/src/system/into_system.rs:147:19
11: bevy_ecs::schedule::executor_parallel::ParallelExecutor::prepare_systems::{{closure}}
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.5.0/src/schedule/executor_parallel.rs:200:30
12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /home/vigdail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
13: async_executor::Executor::spawn::{{closure}}
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:144:13
14: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /home/vigdail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
15: async_task::raw::RawTask<F,T,S>::run
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.0.3/src/raw.rs:489:20
16: async_executor::Executor::try_tick
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:181:17
17: bevy_tasks::task_pool::TaskPool::scope::{{closure}}
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.5.0/src/task_pool.rs:222:21
18: std::thread::local::LocalKey<T>::try_with
at /home/vigdail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
19: std::thread::local::LocalKey<T>::with
at /home/vigdail/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
20: bevy_tasks::task_pool::TaskPool::scope
at /home/vigdail/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.5.0/src/task_pool.rs:169:9
...
The problem
If channels are setup, it is no longer possible to send regular packets. Since the
send
method uses thesender
which has been moved when building channels, it causes panic trying to unwrapNone
. Due to this bug we can not use built-in heartbeat feature along with channels.Steps to reproduce
NetworkingPlugin
withauto_heartbeat_ms: Some(1000)
Possible solution
Create separate senders for packets and messages.
Backtrace