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
If try to filter in a separate asynchronous thread (tokio::spawn), it is required IntermediateBuffer be Send. But it's not.
Is there any way to overcome this?
letmut adapter = AsyncNdisapiAdapter::new(driver, adapter.get_handle())?;
tokio::spawn(asyncmove{// Put network interface into the tunnel mode
adapter
.set_adapter_mode(FilterFlags::MSTCP_FLAG_SENT_RECEIVE_TUNNEL).unwrap();// Allocate IntermediateBufferletmut buffer = vec![IntermediateBuffer::default(); LEN];while !terminate {let len = match adapter.read_packets::<LEN>(&mut buffer).await{Ok(len)if len != 0 => len,
_ => continue,};// Partition the iterator into two collections based on the device flag.let packets:(Vec<_>,Vec<_>) = buffer[0..len].iter_mut().partition(|buffer| {
buffer.get_device_flags() == DirectionFlags::PACKET_FLAG_ON_SEND});// Re-inject packets back into the network stackifletErr(error) = adapter.send_packets_to_adapter::<LEN>(packets.0.into_iter()){println!("Error sending packet to adapter. Error code = {error}");}ifletErr(error) = adapter.send_packets_to_mstcp::<LEN>(packets.1.into_iter()){println!("Error sending packet to mstcp. Error code = {error}");}}// Put the network interface into default mode
adapter.set_adapter_mode(FilterFlags::default()).unwrap();});
Error:
has type`Vec<IntermediateBuffer>` which is not `Send`
The text was updated successfully, but these errors were encountered:
I apologize for the oversight regarding the raw pointers in ListEntry, which led to the IntermediateBuffer not implementing the Send trait. This issue has been addressed and resolved in the latest commit.
If try to filter in a separate asynchronous thread (
tokio::spawn
), it is requiredIntermediateBuffer
beSend
. But it's not.Is there any way to overcome this?
Error:
The text was updated successfully, but these errors were encountered: