...
rust-tun ={ version = "0.5.0", , features = ["async"] }
futures = "0.3.1"
tokio = { version = "0.2", features = ["full"]}
tokio-util = { version = "0.3", features = ["codec", "udp"]}
...
thread 'main' panicked at 'split_to out of bounds: 4 <= 1', /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.4/src/bytes_mut.rs:352:9
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:84
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:61
4: core::fmt::write
at src/libcore/fmt/mod.rs:1025
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1426
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:65
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:50
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:193
9: std::panicking::default_hook
at src/libstd/panicking.rs:210
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:471
11: rust_begin_unwind
at src/libstd/panicking.rs:375
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:84
13: bytes::bytes_mut::BytesMut::split_to
at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.4/src/bytes_mut.rs:352
14: <tun::async::codec::TunPacketCodec as tokio_util::codec::decoder::Decoder>::decode
at /Users/user/CLionProjects/rust-tun/src/async/codec.rs:106
15: <tokio_util::codec::framed_read::FramedRead2<T> as futures_core::stream::Stream>::poll_next
at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.3.1/src/codec/framed_read.rs:269
16: <tokio_util::codec::framed::Framed<T,U> as futures_core::stream::Stream>::poll_next
at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.3.1/src/codec/framed.rs:257
17: <futures_util::stream::stream::split::SplitStream<S> as futures_core::stream::Stream>::poll_next
at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/stream/stream/split.rs:31
18: futures_util::stream::stream::StreamExt::poll_next_unpin
at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/stream/stream/mod.rs:1323
19: <futures_util::stream::stream::next::Next<St> as core::future::future::Future>::poll
at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/stream/stream/next.rs:35
20: std::future::poll_with_tls_context
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/future.rs:99
...
When I was doing something like this
let framed: FramedTunQueue = tun_queue.into_framed();
let (mut tun_sink, mut tun_stream) = framed.split();
while let Some(tun_pkt) = tun_stream.next().await {... // panic at this line
Mac OSX 10.5.14
Cargo.toml
When I was doing something like this